TTEthernet Model for INET Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TTEApplicationBase.cc
Go to the documentation of this file.
1 //
2 // This program is free software: you can redistribute it and/or modify
3 // it under the terms of the GNU Lesser General Public License as published by
4 // the Free Software Foundation, either version 3 of the License, or
5 // (at your option) any later version.
6 //
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public License
13 // along with this program. If not, see http://www.gnu.org/licenses/.
14 //
15 
16 #include "TTEApplicationBase.h"
17 
18 #include "HelperFunctions.h"
19 
20 namespace TTEthernetModel {
21 
22 Define_Module(TTEApplicationBase);
23 
25  Enter_Method("executeCallback(cb)");
26  cb->executeCallback();
27 }
28 
30  buffers.clear();
31  if(ev.isGUI()){
32  //TODO check why this does not work
33  getDisplayString().setTagArg("i2", 0, "");
34  getDisplayString().setTagArg("tt", 0, "");
35  }
36  std::string buffersString = par("buffers").stdstringValue();
37  std::vector<std::string> bufferPaths;
38  split(buffersString,',',bufferPaths);
39  for(std::vector<std::string>::iterator bufferPath = bufferPaths.begin();
40  bufferPath!=bufferPaths.end();bufferPath++){
41  cModule* module = simulation.getModuleByPath((*bufferPath).c_str());
42  if(module){
43  Buffer *buffer = dynamic_cast<Buffer*> (module);
44  if(buffer && buffer->hasPar("ct_id")){
45  buffers[buffer->par("ct_id").longValue()].push_back(buffer);
46  }
47  }
48  else{
49  if(ev.isGUI()){
50  ev<<"Configuration problem: Module "<<(*bufferPath)<<" could not be resolved or is no CT-Buffer (TT or RC)!"<<endl;
51  getDisplayString().setTagArg("i2", 0, "status/excl3");
52  getDisplayString().setTagArg("tt", 0, "WARNING: Configuration Problem Application Buffer!");
53  }
54  }
55  }
56 }
57 
58 } //namespace