23#ifndef UniSetObject_H_
24#define UniSetObject_H_
26#include <condition_variable>
35#include "UniSetTypes.h"
36#include "MessageType.h"
37#include "PassiveTimer.h"
38#include "Exceptions.h"
39#include "UInterface.h"
40#include "UniSetObject_i.hh"
41#include "ThreadCreator.h"
44#include "UHttpRequestHandler.h"
50 class UniSetActivator;
55 typedef std::list< std::shared_ptr<UniSetObject> >
ObjectsList;
74 public std::enable_shared_from_this<UniSetObject>,
75 public POA_UniSetObject_i,
77#ifndef DISABLE_REST_API
82 UniSetObject(
const std::string& name,
const std::string& section );
88 virtual CORBA::Boolean exist()
override;
93 std::string getName()
const;
100 const std::string getStrType();
113 const ::uniset::Timespec& tm,
114 const ::uniset::ProducerInfo& pi,
115 ::CORBA::Long priority,
116 ::CORBA::Long consumer )
override;
118#ifndef DISABLE_REST_API
120 virtual Poco::JSON::Object::Ptr httpGet(
const Poco::URI::QueryParameters& p )
override;
121 virtual Poco::JSON::Object::Ptr httpHelp(
const Poco::URI::QueryParameters& p )
override;
126 std::shared_ptr<UniSetObject> get_ptr();
130 uniset::Message::Priority p = uniset::Message::High )
override;
132 friend std::ostream& operator<<(std::ostream& os,
UniSetObject& obj );
136 std::shared_ptr<UInterface>
ui;
138 std::weak_ptr<UniSetManager> mymngr;
176 void thread(
bool create );
206#ifndef DISABLE_REST_API
208 virtual Poco::JSON::Object::Ptr httpGetMyInfo( Poco::JSON::Object::Ptr root );
209 Poco::JSON::Object::Ptr request_configure(
const std::string& req,
const Poco::URI::QueryParameters& p );
210 Poco::JSON::Object::Ptr request_configure_get(
const std::string& req,
const Poco::URI::QueryParameters& p );
211 Poco::JSON::Object::Ptr request_configure_by_name(
const std::string& name,
const std::string& props );
212 Poco::JSON::Object::Ptr request_params(
const std::string& req,
const Poco::URI::QueryParameters& p );
213 virtual Poco::JSON::Object::Ptr request_params_get(
const std::string& req,
const Poco::URI::QueryParameters& p );
214 virtual Poco::JSON::Object::Ptr request_params_set(
const std::string& req,
const Poco::URI::QueryParameters& p );
219 friend class UniSetManager;
220 friend class UniSetActivator;
225 bool init(
const std::weak_ptr<UniSetManager>& om );
233 void unregistration();
239 pid_t msgpid = { 0 };
240 bool regOK = {
false };
241 std::atomic_bool active;
244 std::unique_ptr<UniSetTimer> tmr;
246 CORBA::Object_var oref;
251 std::unique_ptr< ThreadCreator<UniSetObject> > thr;
255 MQMutex mqueueMedium;
259 std::mutex m_working;
260 std::condition_variable cv_working;
Definition LT_Object.h:98
Definition MessageType.h:127
Definition MessageType.h:171
Definition MessageType.h:283
Definition MessageType.h:214
Definition UHttpRequestHandler.h:95
Definition UniSetObject.h:80
void setID(uniset::ObjectId id)
Definition UniSetObject.cc:154
size_t getMaxSizeOfMessageQueue() const
Definition UniSetObject.cc:172
void offThread()
Definition UniSetObject.cc:643
uniset::ObjectPtr getRef() const
Definition UniSetObject.cc:603
virtual bool deactivateObject()
Деактивация объекта (переопределяется для необходимых действий при завершении работы)
Definition UniSetObject.cc:626
VoidMessagePtr waitMessage(timeout_t msec=UniSetTimer::WaitUpTime)
Definition UniSetObject.cc:202
void onThread()
Definition UniSetObject.cc:648
void setMaxSizeOfMessageQueue(size_t s)
Definition UniSetObject.cc:165
virtual void processingMessage(const uniset::VoidMessage *msg)
Definition UniSetObject.cc:899
size_t countMessages()
Definition UniSetObject.cc:609
virtual void pushMessage(const char *msg, ::CORBA::Long mtype, const ::uniset::Timespec &tm, const ::uniset::ProducerInfo &pi, ::CORBA::Long priority, ::CORBA::Long consumer) override
поместить текстовое сообщение в очередь
Definition UniSetObject.cc:404
size_t getCountOfLostMessages() const
Definition UniSetObject.cc:614
virtual timeout_t askTimer(uniset::TimerId timerid, timeout_t timeMS, clock_t ticks=-1, uniset::Message::Priority p=uniset::Message::High) override
Definition UniSetObject.cc:964
void setThreadPriority(Poco::Thread::Priority p)
Definition UniSetObject.cc:382
std::shared_ptr< UInterface > ui
Definition UniSetObject.h:136
void termWaiting()
Definition UniSetObject.cc:376
virtual bool activateObject()
Активизация объекта (переопределяется для необходимых действий после активизации)
Definition UniSetObject.cc:621
virtual void callback()
Definition UniSetObject.cc:875
VoidMessagePtr receiveMessage()
Definition UniSetObject.cc:191
void thread(bool create)
Definition UniSetObject.cc:638
void setActive(bool set)
Definition UniSetObject.cc:182
virtual void push(const uniset::TransportMessage &msg) override
поместить сообщение в очередь
Definition UniSetObject.cc:388
bool isActive() const
Definition UniSetObject.cc:177
static const timeout_t WaitUpTime
Definition PassiveTimer.h:69
Definition MessageType.h:91
Definition Calibration.h:27
std::list< std::shared_ptr< UniSetObject > > ObjectsList
Definition UniSetObject.h:55
CORBA::Object_ptr ObjectPtr
Definition UniSetTypes.h:94
string< SizeOfObjectType > ObjectType
Definition UniSetTypes_i.idl:33
long ObjectId
Definition UniSetTypes_i.idl:30
long TimerId
Definition UniSetTypes_i.idl:32
Definition UniSetTypes_i.idl:65
Definition UniSetTypes_i.idl:45