Revision c9638ad1

View differences:

scout/libscout/src/BehaviorList.template.cpp
1
#include "BehaviorList.h"
2

  
3
BehaviorList::BehaviorList()
4
{
5
  behavior_list.push_back(behavior<AUTOGEN_BEHAVIOR_BASE_NAME>);
6
  return;
7
}
8

  
9
BehaviorList::~BehaviorList()
10
{
11
  while(!behavior_list.empty())
12
    behavior_list.pop_back();
13
}
scout/libscout/src/BehaviorList.template.h
1
#ifndef _BEHAVIOR_LIST_H_
2
#define _BEHAVIOR_LIST_H_
3

  
4
#include "Behavior.h"
5
#include "Sensors.h"
6
#include "AUTOGEN_BEHAVIOR_LAST_PATH"
7

  
8
template<typename T> Behavior* behavior(std::string scoutname, Sensors* sensors){ return (Behavior*)new T(scoutname, sensors); } 
9

  
10
typedef Behavior* (* behavior_func)(std::string, Sensors*);
11

  
12
class BehaviorList
13
{
14
  public:
15
  std::vector<behavior_func> behavior_list;
16

  
17
  //Constructor. Initializes behavior_list
18
  BehaviorList();
19
  //Destructor. Frees behavior_list;
20
  ~BehaviorList();
21
};
22

  
23
#endif

Also available in: Unified diff