Rev 1310 | Go to most recent revision | Details | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1309 | runge | 1 | /* |
| 2 | * Message.cpp |
||
| 3 | * |
||
| 4 | * Created on: Jul 21, 2009 |
||
| 5 | * Author: Mattias Runge |
||
| 6 | */ |
||
| 7 | |||
| 8 | #include "Message.h" |
||
| 9 | |||
| 10 | namespace atom { |
||
| 11 | namespace message { |
||
| 12 | |||
| 13 | Message::Message(string moduletype, unsigned int moduleId, string type) |
||
| 14 | { |
||
| 15 | LOG.setName("Message"); |
||
| 16 | |||
| 17 | this->myModuletype = moduletype; |
||
| 18 | this->myModuleId = moduleId; |
||
| 19 | this->myType = type; |
||
| 20 | |||
| 21 | // TODO Check if this message is supported for the module |
||
| 22 | |||
| 23 | // TODO Find if this is in our out on module, if out then set myFromModule = true |
||
| 24 | |||
| 25 | // TODO Convert type into variables |
||
| 26 | // TODO Convert type into responses |
||
| 27 | } |
||
| 28 | |||
| 29 | Message::Message() |
||
| 30 | { |
||
| 31 | } |
||
| 32 | |||
| 33 | Message::~Message() |
||
| 34 | { |
||
| 35 | } |
||
| 36 | |||
| 37 | void Message::setOrigin(const void *origin) |
||
| 38 | { |
||
| 39 | //LOG.debug("setOrigin(" + itos((unsigned long) origin) + ")"); |
||
| 40 | this->myOrigin = origin; |
||
| 41 | } |
||
| 42 | |||
| 43 | bool Message::isOrigin(const void *origin) |
||
| 44 | { |
||
| 45 | //LOG.debug("isOrigin(" + itos((unsigned long)origin) + "==" + itos((unsigned long) this->myOrigin) + ")"); |
||
| 46 | return this->myOrigin == origin; |
||
| 47 | } |
||
| 48 | |||
| 49 | |||
| 50 | bool Message::isFromModule() |
||
| 51 | { |
||
| 52 | return this->myFromModule; |
||
| 53 | } |
||
| 54 | |||
| 55 | string Message::getModuletype() |
||
| 56 | { |
||
| 57 | return this->myModuletype; |
||
| 58 | } |
||
| 59 | |||
| 60 | unsigned int Message::getModuleId() |
||
| 61 | { |
||
| 62 | return this->myModuleId; |
||
| 63 | } |
||
| 64 | |||
| 65 | string Message::getType() |
||
| 66 | { |
||
| 67 | return this->myType; |
||
| 68 | } |
||
| 69 | |||
| 70 | Variable & Message::getVariable(string name) |
||
| 71 | { |
||
| 72 | return this->myVariables[name]; |
||
| 73 | |||
| 74 | // TODO Check if it does not exist, throw exception? |
||
| 75 | } |
||
| 76 | |||
| 77 | void Message::readBits(BitBuffer & buffer) |
||
| 78 | { |
||
| 79 | for (variableMap::iterator iter = this->myVariables.begin(); iter != this->myVariables.end(); iter++) |
||
| 80 | { |
||
| 81 | iter->second.readBits(buffer); |
||
| 82 | } |
||
| 83 | } |
||
| 84 | |||
| 85 | |||
| 86 | Message::responseList Message::getResponses() |
||
| 87 | { |
||
| 88 | return this->myResponses; |
||
| 89 | } |
||
| 90 | |||
| 91 | } |
||
| 92 | } |