/* */ #include #include #include #include struct RTSMonitoring { private: /* data */ std::string name; std::string id; int timestimp; int samplerate; int sampleperiod; int downtime; std::list items; public: RTSMonitoring(std::string id, int samplerate, int sampleperiod, int downtime) { this->id = id; this->samplerate = samplerate; this->sampleperiod = sampleperiod; this->downtime = downtime; } RTSMonitoring(std::string id) { this->id = id; } virtual ~RTSMonitoring() {} void Add(std::string item){ this->items.push_back(item); } std::string GetId() { return this->id; } int GetSampleRate() { return this->samplerate; } int GetSamplePeriod(){ return this->sampleperiod; } int GetDownTime(){ return this->downtime; } std::list& GetItems() { return this->items; } bool AddItem(std::string item){ bool ret = true; //add the item to the List this->items.push_back(item); //check if we are ready with this file if (this->items.size() >= 200 ) { // make dict PyLockGIL scoped; //make a dictonary for the rtsMonFrame id, samplerate, sampleperiod, downtime boost::python::dict rtsMonFrameDict; rtsMonFrameDict["id"] = this->GetId(); rtsMonFrameDict["samplerate"] = this->GetSampleRate(); rtsMonFrameDict["sampleperiod"] = this->GetSamplePeriod(); rtsMonFrameDict["downtime"] = this->GetDownTime(); //make a dictonary for the sampleItems boost::python::list rtsMonItemsList; auto items = this->items; for (auto iter = items.begin(); iter!= items.end(); ++iter) { rtsMonItemsList.append(*iter); } rtsMonFrameDict["items"]= rtsMonItemsList; return add2Script(); } } virtual bool add2Script() = 0; };