Commit 4fc1bf30 authored by Augustin Degomme's avatar Augustin Degomme
Browse files

fix compilation problem with new boost libraries, add a few comments, much more to do

parent be0ff922
......@@ -811,10 +811,8 @@ _state_tree=NULL;
if (_variables.find(type)==_variables.end()){
_variables.insert(std::pair<VariableType*, Variable*>(type,&((*it)->_variables[i])));
printf("%s inserting variable %s %d\n", this->get_name().to_string().c_str(),((*it)->_variables[i]).get_type()->get_name().to_string().c_str(), ((*it)->_variables[i]).get_values()->size());
//printf("%s inserting variable %s %d\n", this->get_name().to_string().c_str(),((*it)->_variables[i]).get_type()->get_name().to_string().c_str(), ((*it)->_variables[i]).get_values()->size());
_n_variables++;
}else{
if(((*it)->_variables[i]).get_values()!=NULL){
......
/*
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
#include <iostream>
#include <string>
#include <map>
......
/*
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
#ifndef INTERVALOFCONTAINER_HPP
#define INTERVALOFCONTAINER_HPP
......@@ -23,53 +66,167 @@
#include "trace/Serializer_structs.hpp"
typedef struct IntervalOfContainer {
// Loaded
// Defines if the interval is loaded into memory or stored inside a file (yes=in memory, no=out of core)
bool _loaded;
// Intervale de temps
// Time Interval
Date _beginning;
Date _end;
// Tableau des changements d’etat dans l’interval
// Statechanges in this ITC
StateChange* _statechanges;
//number of StateChanges in this ITC
int _n_statechanges;
//States in this ITC
State* _states;
//number of States in this ITC
int _n_states;
//aggregagted value of each one of the values in the chunk. For preview purpose
//aggregated value of each one of the values in the chunk. For preview purpose
std::map<EntityValue* , double>* _states_values_map;
// Tableau des evenements dans l’intervalle
// Events in this ITC
Event* _events;
//number of Events in this ITC
int _n_events;
// Tableau des liens dans l’intervalle
// Links in this ITC
Link* _links;
//number of Links in this ITC
int _n_links;
//variables in this ITC
Variable* _variables;
//number of variables in this ITC
int _n_variables;
public :
IntervalOfContainer();
~IntervalOfContainer();
/*!
* \brief Constructor
*/
IntervalOfContainer();
/*!
* \brief Destructor
*/
~IntervalOfContainer();
/*!
* \fn get_beginning() const
* \brief Get the beginning Date of the ITC
*/
Date get_beginning();
/*!
* \fn get_end() const
* \brief Get the end date of the ITC
*/
Date get_end();
std::map<EntityValue* , double>* get_states_values_map();
/*!
* \fn add_state
* \brief add a State to the ITC
* \param start Starting Date of the State
* \param end Ending Date of the State
* \param type StateType
* \param value value of the State
* \param container Container containing this State
* \param opt Extra fields
* \returns a pointer to the State
*/
State* add_state(Date start, Date end, StateType *type, EntityValue *value, Container *container, std::map<std::string, Value *> opt);
/*!
* \fn add_state(Date , State*, State* )
* \brief add a StateChange to the ITC
* \param time Date of the StateChange
* \param left left State
* \param right right State
* \return a boolean, true if the StateChange has been successfully added, false if the IntervalOfContainer is full and need to be changed
*/
bool add_statechange(Date time, State *left, State *right);
/*!
* \fn add_event
* \brief add an Event to the ITC
* \param time Date of the Event
* \param type EventType
* \param value value of the Event
* \param container Container containing this Event
* \param opt Extra fields
*/
void add_event(Date time, EventType *type, Container* cont, EntityValue *value, std::map<std::string, Value *> opt);
/*!
* \fn set_variable
* \brief add a variable to the ITC
* \param container Container containing this Event
* \param v VariableType
*/
void set_variable(Container *container, VariableType* v);
/*!
* \fn set_variables
* \brief add a set of variables to the ITC
* \param the map of variables to add
*/
void set_variables(std::map<VariableType *, Variable *>*);
/*!
* \fn add_link
* \brief add a Link to the ITC
* \param start Starting Date of the Link
* \param end Ending Date of the Link
* \param container Container containing this Link
* \param source source Container
* \param destination destination Container
* \param value value of the Event
* \param opt Extra fields
*/
bool add_link(Date start, Date end, LinkType *type, Container *container, Container *source, Container *destination, EntityValue *value, std::map<std::string, Value *> opt);
int is_loaded();
/*!
* \fn is_loaded
* \brief returns the loaded state of the ITC
*/
bool is_loaded(){return _loaded;}
/*!
* \fn get_states_values_map
* \brief returns the aggregated value of each one of the States in the chunk. For preview purposes.
*/
std::map<EntityValue* , double>* get_states_values_map();
#ifdef BOOST_SERIALIZE
/*!
* \fn unload()
* \brief unload data from memory without deleting the element and sets its loaded value to false
*/
void unload();
/*!
* \fn dump_on_disk()
* \brief dump data from the ITC on disk
* \param filename The file containig the ITC
* \return true if no error is encountered
*/
bool dump_on_disk(const char* filename);
/*!
* \fn retrieve()
* \brief retrieve data from a file to the mail memory
* \param filename The file containig the ITC
* \return true if no error is encountered
*/
bool retrieve(const char* filename);
/*!
* \fn save()
* \brief boost serialization function for an ITC
*/
template<class Archive>
void save(Archive & ar, const unsigned int ) const
{
......@@ -177,6 +334,11 @@ typedef struct IntervalOfContainer {
}
//printf("variables %p\n", this);
}
/*!
* \fn load()
* \brief boost serialization function for an ITC
*/
template<class Archive>
void load(Archive & ar, const unsigned int )
{
......
......@@ -103,9 +103,12 @@
#if BOOST_VERSION < 103600
#include <boost/integer/endian.hpp>
#include <boost/math/fpclassify.hpp>
#else
#elif BOOST_VERSION < 104800
#include <boost/spirit/home/support/detail/integer/endian.hpp>
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
#else
#include <boost/spirit/home/support/detail/endian.hpp>
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
#endif
// namespace alias
......@@ -264,7 +267,11 @@ namespace eos {
// load the value from little endian - is is then converted
// to the target type T and fits it because size <= sizeof(T)
#if BOOST_VERSION < 104800
t = boost::detail::load_little_endian<T, sizeof(T)>(&temp);
#else
t = boost::spirit::detail::load_little_endian<T, sizeof(T)>(&temp);
#endif
}
else t = 0; // zero optimization
......
......@@ -103,9 +103,12 @@
#if BOOST_VERSION < 103600
#include <boost/integer/endian.hpp>
#include <boost/math/fpclassify.hpp>
#else
#elif BOOST_VERSION < 104800
#include <boost/spirit/home/support/detail/integer/endian.hpp>
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
#else
#include <boost/spirit/home/support/detail/endian.hpp>
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
#endif
// namespace alias
......@@ -241,7 +244,11 @@ namespace eos {
// we choose to use little endian because this way we just
// save the first size bytes to the stream and skip the rest
#if BOOST_VERSION < 104800
boost::detail::store_little_endian<T, sizeof(T)>(&temp, t);
#else
boost::spirit::detail::store_little_endian<T, sizeof(T)>(&temp, t);
#endif
save_binary(&temp, size);
}
// zero optimization
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment