00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <pantheios/pantheios.hpp>
00027
00028
00029 #include <platformstl/platformstl.hpp>
00030
00031
00032 #include <exception>
00033 #include <string>
00034 #include <stdlib.h>
00035
00036 #if defined(PLATFORMSTL_OS_IS_UNIX)
00037 # include <dirent.h>
00038 #endif
00039
00040
00041
00042
00043 PANTHEIOS_EXTERN_C const char FE_SIMPLE_PROCESS_IDENTITY[] = "example_cpp_hetero1";
00044
00045
00046
00047 int main()
00048 {
00049 try
00050 {
00051
00052 #if defined(PLATFORMSTL_OS_IS_UNIX)
00053
00054
00055
00056
00057
00058
00059
00060 time_t t = ::time(NULL);
00061 struct tm *tm = ::localtime(&t);
00062 DIR *d = ::opendir(".");
00063 struct dirent *de = (NULL != d) ? readdir(d) : NULL;
00064
00065
00066 pantheios::log_NOTICE("Heterogeneous values: tm=", tm, "; de=", de);
00067
00068 if(NULL != d)
00069 {
00070 ::closedir(d);
00071 }
00072
00073 #elif defined(PLATFORMSTL_OS_IS_WIN32)
00074
00075
00076
00077
00078
00079
00080
00081 GUID g = GUID_NULL;
00082 SYSTEMTIME s;
00083 VARIANT v;
00084
00085 ::GetLocalTime(&s);
00086
00087 ::VariantInit(&v);
00088 v.vt = VT_I4;
00089 v.lVal = 123456789;
00090
00091 pantheios::log_NOTICE("Heterogeneous values: g=", g, "; s=", s, "; v=", v);
00092
00093 #else
00094 # error Operating system not discriminated
00095 #endif
00096
00097 return EXIT_SUCCESS;
00098 }
00099 catch(std::bad_alloc &)
00100 {
00101 pantheios::log_CRITICAL("out of memory");
00102 }
00103 catch(std::exception &x)
00104 {
00105 pantheios::log_ALERT("Exception: ", x);
00106 }
00107 catch(...)
00108 {
00109 pantheios::puts(pantheios::emergency, "Unexpected unknown error");
00110 }
00111
00112 return EXIT_FAILURE;
00113 }
00114
00115