Node.hpp 3.16 KB
Newer Older
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 36 37 38 39
/*


J'ai besoin d'ajouter a la structure node :

1 intervalle pour dire la taille de l'intervalle ou je suis 

1 tableau de 4 intervalles donnant les intervalles a conflit

Un tableau de 2 entiers donnant si les fils sont pas encore parcours ( 0 ), affichable ( 1 ), non affichable ( 2 ), ...

Peut etre un booleen donnant le fait que l'on soit affiche ou pas















 */











40 41
/*
 *
Kevin Coulomb's avatar
Kevin Coulomb committed
42
 *\file tree/Node.hpp
43
 * \brief File that contains the definition of a Node in the binary tree that contain the events. A node is not linked to other nodes, it represents more the 'decoration'  of a node than a node in the usual meaning.
44 45 46 47 48 49
 *\author COULOMB Kevin
 *\date 03/09
 *
 */


Kevin Coulomb's avatar
Kevin Coulomb committed
50 51
#ifndef NODEEVENT_HPP
#define NODEEVENT_HPP
52 53

#include <iostream>
Kevin Coulomb's avatar
Kevin Coulomb committed
54
#include "../values/Date.hpp"
55 56 57 58 59
#include "Interval.hpp"
#include "Data.hpp"



60
template <class E>
61 62
class Node{
  
63
private :
64 65 66 67 68
  /*
   *
   *\brief Used in the structure to know whether it is the beginning or the event of a state
   *
   */
Kevin Coulomb's avatar
Kevin Coulomb committed
69 70
  static const int _BEGINNING=0;
  static const int _END=1;
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
  
  
  /*
   *
   *\brief The moment when the event happen
   *
   */
  Date _happen;
  
  /*
   *
   *\brief Keeps the intervalls of it's children that have conflicts
   *
   */
  Interval * _interval;
  
  
  /*
   *
   *\brief To know whether it is the beginning or the end of an event
   *
   */
Kevin Coulomb's avatar
Kevin Coulomb committed
93
  int _type_of_event;
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
  
  /*
   *
   *\brief Contains the information of the event that will be used when more information aboit a state are required :
   * Name, type if it is a state, ...
   *
   */
  Data <E> * _caracteristic_of_event;
  
  
  
public :
  
  /*
   *
   *\fn Node()
   *\brief Default constructor
   *
   */
  Node(){
    _happen = 0;
    _interval = new Interval();
    _caracteristic_of_event = new Data<E>();
  }
  
  /*
   *
   *\fn ~Node()
   *\brief Destructor
   *
   */
  ~Node(){
    delete _interval;
  }
  
  /*
   *
   *\fn setTypeOfEvent(int TYPE)
   *\brief Set the type of event to BEGINNING or END
   *
   */
  void setTypeOfEvent(int TYPE){
Kevin Coulomb's avatar
Kevin Coulomb committed
136
    _type_of_event = TYPE;
137 138 139 140 141 142 143 144 145
  }
  
  /*
   *
   *\fn getTypeOfEvent()
   *\brief Get the type of event to BEGINNING or END
   *
   */
  int getTypeOfEvent(){
Kevin Coulomb's avatar
Kevin Coulomb committed
146
    return _type_of_event;
147 148 149 150 151 152 153 154 155 156
  }
  
  /*
   *
   *\fn getCaracteristic( Data* data )
   *\brief Get all the caracteristic of the data
   *
   */
  
  Data <E> * getCaracteristic(){
Kevin Coulomb's avatar
Kevin Coulomb committed
157
    return _caracteristic_of_event;
158 159 160 161
  }
  
  /*
   *
Kevin Coulomb's avatar
Kevin Coulomb committed
162
   *\fn get_name()
163 164 165
   *\brief Returns only the name of the container in the data
   *
   */
Kevin Coulomb's avatar
Kevin Coulomb committed
166
  std::string get_name(){
Kevin Coulomb's avatar
Kevin Coulomb committed
167
    return (_caracteristic_of_event->get_name());
168
  }
Kevin Coulomb's avatar
Kevin Coulomb committed
169 170 171 172 173 174 175 176
 
  /*
   *
   *\fn set_name()
   *\brief Set the name of the container
   *
   */
  void set_name(std::string s){
Kevin Coulomb's avatar
Kevin Coulomb committed
177
    _caracteristic_of_event->set_name(s);
Kevin Coulomb's avatar
Kevin Coulomb committed
178 179 180
  }


181 182 183 184 185 186 187 188

  /*
   *
   *\fn getDescription()
   *\brief Returns only the description of the data
   *
   */
  std::string getDescription(){
Kevin Coulomb's avatar
Kevin Coulomb committed
189
    return _caracteristic_of_event->getDescription();
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
  }
    
  /*
   *
   *\fn getDate()
   *\brief Return the date when the event happens
   *
   */
  Date * getDate(){
     return _happen;
  }

  /*
   *
   *\fn setDate(Date * date)
   *\fn Set happen parameter to date
   *
   */
  void setDate( Date * date){
    _happen = * date;
  }

};



#endif