00001 #include <cassert>
00002 #include <cstdarg>
00003 #include <cstdlib>
00004 #include <iostream>
00005 #include <boost/thread.hpp>
00006 #include <boost/asio.hpp>
00007 #include <boost/bind.hpp>
00008 #include <boost/date_time/posix_time/posix_time.hpp>
00009 #include <boost/statechart/event.hpp>
00010 #include <boost/statechart/state_machine.hpp>
00011 #include <boost/statechart/simple_state.hpp>
00012 #include <boost/statechart/transition.hpp>
00013 #include <boost/interprocess/shared_memory_object.hpp>
00014 #include <boost/interprocess/mapped_region.hpp>
00015
00016 #include <msgpack.hpp>
00017
00018 #include <Category.hh>
00019 #include <FileAppender.hh>
00020 #include <PatternLayout.hh>
00021
00022 #include "Listener.h"
00023 #include "EventSender.h"
00024 #include "TimeStampedEvent.h"
00025 #include "PolymorphEvent.h"
00026
00027 #include <map>
00028 #include <utility>
00029 #include <map>
00030 #include <string>
00031 #include <queue>
00032
00033 #define CLIEVER
00034
00035 #include "mdcommon.h"
00036
00037 #ifdef MD_MAND
00038 #include <clipsmm/clipsmm.h>
00039 #endif
00040
00041 #include "cdEvents.h"
00042 #include "mdCommander.h"
00043
00044 #include "mdBehavior.h"
00045 #include "mdObservable.h"
00046 #include "mdState.h"
00047
00048
00049 #define CD_EPOCH date()
00050 #define CD_GLOBAL_SIZE 4096
00051 #define CD_LOCK_FILE "auc-cd.lock"
00052 #define CD_NAME DACLIPS_APP " Cliever"
00053 #define CD_VERSION "1.1"
00054 #define CD_REFRESH MD_HEARTBEAT // default milliseconds between telemetry frame updates
00055 #define CD_MAX_DEVICE 4 // including ourselves
00056
00057
00058 #include "clientDaemonConfig.h"
00059
00060 typedef std::map<std::string,mdObservable*> ObservablesOfInterest;
00061 typedef std::map<std::string,mdOperationalDataElement*> ODEsOfInterest;
00062
00063 #include "cdLogger.h"
00064
00065 class cdDataLayer;
00066 class mdCliever;
00067
00068
00069 #ifdef CD_MAIN
00070
00071 auc_cd_global *gm;
00072 boost::asio::io_service io_bg,io_fg;
00073 cdLogger theseLogs;
00074 clientDaemonConfig *thisConfig;
00075 mdCliever *thisCliever;
00076
00077 #ifdef MD_MAND
00078 DACLIPS::Environment rules[2];
00079 #endif
00080
00081 extern void runDataLayer();
00082 extern void runCliever();
00083 extern void shutdown();
00084
00085 #else
00086
00087 extern auc_cd_global *gm;
00088 extern boost::asio::io_service io_bg,io_fg;
00089 extern const char *cdOrKb;
00090 extern cdLogger theseLogs;
00091 extern clientDaemonConfig *thisConfig;
00092 extern mdCliever *thisCliever;
00093
00094 #ifdef MD_MAND
00095 extern DACLIPS::Environment rules[2];
00096 #endif
00097
00098 #endif
00099
00100 #include "clientDaemon.h"
00101