| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
#include <Environment/vjCommand.h> |
|---|
| 36 |
#include <Environment/vjTimedUpdate.h> |
|---|
| 37 |
#include <Config/vjConfigChunkDB.h> |
|---|
| 38 |
#include <Config/vjChunkDescDB.h> |
|---|
| 39 |
|
|---|
| 40 |
void vjCommand::resetFireTime (vjTimeStamp& ts) { |
|---|
| 41 |
next_fire_time = ts.usecs()/1000 + refresh_time; |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
int vjCommand::operator < (const vjCommand& cmd2) { |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
return (next_fire_time < cmd2.next_fire_time); |
|---|
| 48 |
} |
|---|
| 49 |
|
|---|
| 50 |
std::string vjCommand::getName () { |
|---|
| 51 |
return (std::string)"generic vjCommand"; |
|---|
| 52 |
} |
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
vjCommandRefresh::vjCommandRefresh() { |
|---|
| 58 |
next_fire_time = refresh_time = 0.0; |
|---|
| 59 |
} |
|---|
| 60 |
|
|---|
| 61 |
void vjCommandRefresh::call (std::ostream& out) { |
|---|
| 62 |
out << "Refresh all" << std::endl; |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
vjCommandSendChunkDB::vjCommandSendChunkDB (vjConfigChunkDB* _db, bool _all) { |
|---|
| 70 |
db = _db; |
|---|
| 71 |
all = _all; |
|---|
| 72 |
} |
|---|
| 73 |
|
|---|
| 74 |
void vjCommandSendChunkDB::call (std::ostream& out) { |
|---|
| 75 |
if (all) |
|---|
| 76 |
out << "chunks all\n"; |
|---|
| 77 |
else |
|---|
| 78 |
out << "chunks\n"; |
|---|
| 79 |
out << *db << std::flush; |
|---|
| 80 |
} |
|---|
| 81 |
|
|---|
| 82 |
std::string vjCommandSendChunkDB::getName () { |
|---|
| 83 |
return (std::string)"Send ChunkDB command"; |
|---|
| 84 |
} |
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
vjCommandSendDescDB::vjCommandSendDescDB (vjChunkDescDB* _db, bool _all) { |
|---|
| 90 |
db = _db; |
|---|
| 91 |
all = _all; |
|---|
| 92 |
} |
|---|
| 93 |
|
|---|
| 94 |
void vjCommandSendDescDB::call (std::ostream& out) { |
|---|
| 95 |
if (all) |
|---|
| 96 |
out << "descriptions all\n" << std::flush; |
|---|
| 97 |
else |
|---|
| 98 |
out << "descriptions\n" << std::flush; |
|---|
| 99 |
out << *db << std::flush; |
|---|
| 100 |
} |
|---|
| 101 |
|
|---|
| 102 |
std::string vjCommandSendDescDB::getName () { |
|---|
| 103 |
return (std::string)"Send DescDB command"; |
|---|
| 104 |
} |
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
vjCommandTimedUpdate::vjCommandTimedUpdate (vjTimedUpdate* _tu, float _refresh_time) { |
|---|
| 110 |
timed_update = _tu; |
|---|
| 111 |
refresh_time = _refresh_time; |
|---|
| 112 |
next_fire_time = 0; |
|---|
| 113 |
} |
|---|
| 114 |
|
|---|
| 115 |
void vjCommandTimedUpdate::call (std::ostream& out) { |
|---|
| 116 |
timed_update->write (out); |
|---|
| 117 |
} |
|---|
| 118 |
|
|---|
| 119 |
std::string vjCommandTimedUpdate::getName () { |
|---|
| 120 |
return (std::string)"Timed Update Command; tu obj is " + timed_update->getName(); |
|---|
| 121 |
} |
|---|
| 122 |
|
|---|