COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
Cosmos::Support::Scheduler Class Reference

#include <scheduler.h>

Collaboration diagram for Cosmos::Support::Scheduler:

Public Member Functions

 Scheduler (string node_name)
 
 ~Scheduler ()
 
void addEvent (string name, string data, double utc, string condition, uint32_t flag)
 
void addEvent (Event event)
 
void deleteEvent (string name, string data, double utc, string condition, uint32_t flag)
 
void deleteEvent (Event event)
 
int getEventQueueSize ()
 
void getEventQueue ()
 

Private Attributes

Agentagent
 
beatstruc agent_exec_soh
 

Constructor & Destructor Documentation

Cosmos::Support::Scheduler::Scheduler ( string  node_name)
41  {
42 
43  agent = new Agent(node_name, "test");
45 
46  }
Agent * agent
Definition: scheduler.h:59
beatstruc agent_exec_soh
Definition: scheduler.h:60
string node_name
Definition: agent_001.cpp:46
Definition: agentclass.h:139
beatstruc find_agent(string node, string agent, double waitsec=0.)
Find agent.
Definition: agentclass.cpp:559
Cosmos::Support::Scheduler::~Scheduler ( )
48  {
49 
50  }

Member Function Documentation

void Cosmos::Support::Scheduler::addEvent ( string  name,
string  data,
double  utc,
string  condition,
uint32_t  flag 
)
56  {
57 
58  Event event;
59  event.generator(name, data, mjd, condition, flag);
60 
61  //com.set_command(line);
62 
63  if (!agent_exec_soh.exists) { // TODO: change the way to find if another beat exists (no mjd)
64  cout << "could not find agent exec" << endl;
65  return;
66  }
67 
68  string out;
69  agent->send_request(agent_exec_soh, "add_event "+ event.event_string, out, 0);
70 
71  cout << "event set: " << endl;
72  cout << out << endl;
73 
74  }
Agent * agent
Definition: scheduler.h:59
Class to manage Event information.
Definition: event.h:57
int32_t send_request(beatstruc cbeat, string request, string &output, float waitsec=5.)
Send a request over AGENT.
Definition: agentclass.cpp:424
string generator(string name, string data, double utc, string condition, uint32_t flag)
Definition: event.cpp:53
beatstruc agent_exec_soh
Definition: scheduler.h:60
bool exists
Existence Flag (if beat exists then flag is set to true, false otherwise)
Definition: jsondef.h:950
string name
Definition: cubesat2obj.cpp:6
string event_string
Definition: event.h:79
double mjd
Definition: udp_send.cpp:41
void Cosmos::Support::Scheduler::addEvent ( Event  event)
76  {
77  addEvent(event.name, event.data, event.mjd, event.condition, event.flag);
78  }
uint32_t flag
Definition: event.h:70
string name
Definition: event.h:66
double mjd
Definition: event.h:62
string data
Definition: event.h:72
string condition
Definition: event.h:74
void addEvent(string name, string data, double utc, string condition, uint32_t flag)
Definition: scheduler.cpp:52
void Cosmos::Support::Scheduler::deleteEvent ( string  name,
string  data,
double  utc,
string  condition,
uint32_t  flag 
)
84  {
85 
86  Event event;
87 
88  // set the event_string
89  // JIMNOTE: this could be done in a constructor
90  event.generator(name, data, mjd, condition, flag);
91 
92  if (!agent_exec_soh.exists) {
93  cout << "could not find agent exec" << endl;
94  return;
95  }
96 
97  string out;
98  agent->send_request(agent_exec_soh, "del_event "+ event.event_string, out, 0);
99 
100  cout << "event deleted: " << out << endl;
101 
102  }
Agent * agent
Definition: scheduler.h:59
Class to manage Event information.
Definition: event.h:57
int32_t send_request(beatstruc cbeat, string request, string &output, float waitsec=5.)
Send a request over AGENT.
Definition: agentclass.cpp:424
string generator(string name, string data, double utc, string condition, uint32_t flag)
Definition: event.cpp:53
beatstruc agent_exec_soh
Definition: scheduler.h:60
bool exists
Existence Flag (if beat exists then flag is set to true, false otherwise)
Definition: jsondef.h:950
string name
Definition: cubesat2obj.cpp:6
string event_string
Definition: event.h:79
double mjd
Definition: udp_send.cpp:41
void Cosmos::Support::Scheduler::deleteEvent ( Event  event)
104  {
105  deleteEvent(event.name,event.data, event.mjd, event.condition, event.flag);
106  }
uint32_t flag
Definition: event.h:70
string name
Definition: event.h:66
double mjd
Definition: event.h:62
void deleteEvent(string name, string data, double utc, string condition, uint32_t flag)
Definition: scheduler.cpp:80
string data
Definition: event.h:72
string condition
Definition: event.h:74
int Cosmos::Support::Scheduler::getEventQueueSize ( )
108  {
109  if (!agent_exec_soh.exists) {
110  cout << "could not find agent exec" << endl;
111  return 0 ;
112  }
113 
114  string out;
115  agent->send_request(agent_exec_soh, "get_queue_size", out, 0);
116 
117  StringParser str(out,'[');
118  int queue_size = str.getFieldNumberAsInteger(1);
119  cout << "Event queue size: " << queue_size << endl;
120 
121  return queue_size;
122  }
Agent * agent
Definition: scheduler.h:59
int32_t send_request(beatstruc cbeat, string request, string &output, float waitsec=5.)
Send a request over AGENT.
Definition: agentclass.cpp:424
beatstruc agent_exec_soh
Definition: scheduler.h:60
const string & str
Definition: json11.cpp:360
bool exists
Existence Flag (if beat exists then flag is set to true, false otherwise)
Definition: jsondef.h:950
Definition: stringlib.h:89
void Cosmos::Support::Scheduler::getEventQueue ( )
124  {
125  if (!agent_exec_soh.exists) {
126  cout << "could not find agent exec" << endl;
127  return ;
128  }
129 
130  string out;
131  agent->send_request(agent_exec_soh, "get_event", out, 0);
132 
133  //StringParser str(out,'[');
134  //int queue_size = str.getFieldNumberAsInteger(1);
135  cout << endl << "queue list: " << endl << out << endl;
136 
137  // return queue_size;
138  }
Agent * agent
Definition: scheduler.h:59
int32_t send_request(beatstruc cbeat, string request, string &output, float waitsec=5.)
Send a request over AGENT.
Definition: agentclass.cpp:424
beatstruc agent_exec_soh
Definition: scheduler.h:60
bool exists
Existence Flag (if beat exists then flag is set to true, false otherwise)
Definition: jsondef.h:950

Member Data Documentation

Agent* Cosmos::Support::Scheduler::agent
private
beatstruc Cosmos::Support::Scheduler::agent_exec_soh
private

The documentation for this class was generated from the following files: