UniSet  2.2.1
LProcessor.h
00001 #ifndef LProcessor_H_
00002 #define LProcessor_H_
00003 // --------------------------------------------------------------------------
00087 // --------------------------------------------------------------------------
00088 #include <list>
00089 #include <atomic>
00090 #include "UniSetTypes.h"
00091 #include "UInterface.h"
00092 #include "Element.h"
00093 #include "Schema.h"
00094 // --------------------------------------------------------------------------
00095 class LProcessor
00096 {
00097     public:
00098         explicit LProcessor( const std::string& name = "" );
00099         virtual ~LProcessor();
00100 
00101         void open( const std::string& lfile );
00102 
00103         inline bool isOpen()
00104         {
00105             return !fSchema.empty();
00106         }
00107 
00108         virtual void execute( const std::string& lfile = "" );
00109 
00110         virtual void terminate()
00111         {
00112             canceled = true;
00113         }
00114 
00115         inline std::shared_ptr<SchemaXML> getSchema()
00116         {
00117             return sch;
00118         }
00119 
00120         inline int getSleepTime()
00121         {
00122             return sleepTime;
00123         }
00124 
00125     protected:
00126 
00127         virtual void build( const string& lfile );
00128 
00129         virtual void step();
00130 
00131         virtual void getInputs();
00132         virtual void processing();
00133         virtual void setOuts();
00134 
00135         struct EXTInfo
00136         {
00137             UniSetTypes::ObjectId sid;
00138             UniversalIO::IOType iotype;
00139             bool state;
00140             std::shared_ptr<Element> el;
00141             int numInput = { -1};
00142         };
00143 
00144         struct EXTOutInfo
00145         {
00146             UniSetTypes::ObjectId sid;
00147             UniversalIO::IOType iotype;
00148             std::shared_ptr<Element> el;
00149         };
00150 
00151         typedef std::list<EXTInfo> EXTList;
00152         typedef std::list<EXTOutInfo> OUTList;
00153 
00154         EXTList extInputs;
00155         OUTList extOuts;
00156 
00157         std::shared_ptr<SchemaXML> sch;
00158 
00159         UInterface ui;
00160         timeout_t sleepTime = { 200 };
00161         timeout_t smReadyTimeout = { 30000 } ;     
00163         std::string logname = { "" };
00164 
00165         std::atomic_bool canceled = {false};
00166 
00167         std::string fSchema = {""};
00168 
00169     private:
00170 };
00171 // ---------------------------------------------------------------------------
00172 #endif