30#ifndef _libDEM_SetOf_hpp_
31#define _libDEM_SetOf_hpp_
38#include <boost/serialization/vector.hpp>
39#include <boost/serialization/string.hpp>
40#include <boost/serialization/serialization.hpp>
41#include <boost/serialization/export.hpp>
42#include <boost/type_traits.hpp>
43#include <boost/static_assert.hpp>
45#include <vtkUnstructuredGrid.h>
88 template<
typename type>
class SetOf;
90 template<
typename type>
94 friend class SetOf<type>;
97 typedef std::map<const std::string, SetOf<type>*>
mapType;
104 bool exist(
const std::string&)
const;
109 void save_it(boost::archive::text_oarchive&,
const unsigned int);
110 void load_it(boost::archive::text_iarchive&,
const unsigned int);
111 void record(boost::archive::text_oarchive&);
112 void record(boost::archive::text_iarchive&);
137 template<
class Archive>
void save(Archive&,
const unsigned int )
const;
138 template<
class Archive>
void load(Archive&,
const unsigned int);
151 template<
typename type>
193 virtual void add_item(type* item,
bool check =
true);
194 virtual void add_item(type& item,
bool check =
true);
195 virtual void add_item(std::vector<type *>& vector,
bool check =
true);
209 typename std::vector<type *>::iterator
begin();
210 typename std::vector<type *>::iterator
end();
212 typename std::vector<type *>::const_iterator
begin()
const;
213 typename std::vector<type *>::const_iterator
end()
const;
220 template<
class Archive>
void save(Archive& ar,
const unsigned int version)
const;
221 template<
class Archive>
void load(Archive& ar,
const unsigned int version);
228 template<
class type>
class Register;
231 template <
typename T>
234 template<
typename type>
245 static std::string
class_ID() {
return std::string(
"Core::SetOf<" + type::class_ID()+
">");}
255 static bool exist(
const std::string&
id);
279 virtual void add_item(std::vector<type *> &,
bool check =
true);
331 template<
class Archive>
void save(Archive&,
const unsigned int )
const;
332 template<
class Archive>
void load(Archive&,
const unsigned int);
348 friend class SetOf<type>;
385#include "GranOO3/Core/SetOfMap.tpp"
386#include "GranOO3/Core/SetOfBase.tpp"
387#include "GranOO3/Core/SetOf.tpp"
388#include "GranOO3/Core/Register.tpp"
ExtendedSetOf(std::vector< type * > &)
Definition ExtendedSetOf.hpp:59
void erase_from_all_setof()
const unsigned long long int _numericID
Definition SetOf.hpp:377
bool belong_to_setof(const std::string &setOfId) const
bool already_exist(SetOf< type > &)
bool belong_to_setof(const SetOf< type > &set) const
static unsigned long long int _numericID_counter
Definition SetOf.hpp:372
std::list< SetOf< type > * > _setof_list
Definition SetOf.hpp:376
void erase_setof(SetOf< type > &)
void add_setof(SetOf< type > &)
SetOf< type > & _globalset
Definition SetOf.hpp:375
unsigned long long int get_numeric_ID() const
std::list< SetOf< type > * > & get_setof_list()
type * get_item_by_rank(size_t i)
const type & first() const
const type * get_item_by_rank(size_t i) const
std::vector< type * >::iterator end()
virtual void clear_and_delete()
virtual void add_item(std::vector< type * > &vector, bool check=true)
bool contain(const type &item) const
type * operator[](size_t i)
type & get_item(size_t i)
std::vector< type * >::iterator begin()
const type & operator()(size_t i) const
size_t get_rank(const type *item) const
const type & last() const
virtual void erase_item(type &item)
virtual void clear_and_delete_with_progress(const std::string &)
std::vector< type * >::const_iterator end() const
SetOfBase(const SetOfBase< type > &set)
BOOST_SERIALIZATION_SPLIT_MEMBER()
virtual void erase_item(type *item)
void save(Archive &ar, const unsigned int version) const
bool contain(const type *item) const
const type & get_item(size_t i) const
type & operator()(size_t i)
std::vector< type * >::const_iterator begin() const
const std::vector< type * > & get_vector() const
virtual void add_item(type &item, bool check=true)
virtual void add_item(SetOfBase< type > &, bool check=true)
size_t get_rank(const type &item) const
virtual void add_item(type *item, bool check=true)
void load(Archive &ar, const unsigned int version)
std::vector< type * > _item_vector
Definition SetOf.hpp:216
const type * operator[](size_t i) const
friend class boost::serialization::access
Definition SetOf.hpp:219
Definition SetOfGeneric.hpp:46
SetOfGeneric(const std::string &)
Definition SetOfGeneric.cpp:39
bool is_global_set() const
static SetOf< type > & pull(const std::string &id)
void add_item_in_class_hierarchy(type *, SetOfGeneric *)
SetOf(const std::string &id)
static SetOf< type > & get_setof_by_ID(const std::string &id)
static SetOf< type > & get()
static type & get_item_by_base_class_rank(size_t i)
SetOf< typename type::base > * _childset
Definition SetOf.hpp:336
SetOf< typename type::base > * get_base_class_set(SetOfGeneric *)
void erase_item_in_class_hierarchy(type *, SetOfGeneric *)
Signal< type & > & get_signal_erase_item()
static void * get_item_by_base_class_rank(size_t i, size_t classID)
void make_difference(SetOf< type > &set1, SetOf< type > &set2)
virtual void add_item(std::vector< type * > &, bool check=true)
static void delete_from_map(SetOf< type > &)
void load(Archive &, const unsigned int)
static std::string get_global_str_key()
Definition SetOf.hpp:246
static SetOf< type > * get_setof_ptr_by_ID(const std::string &id)
void make_intersection(SetOf< type > &set1, SetOf< type > &set2)
virtual void erase_item(type *)
bool has_intersection(SetOf< type > &set)
Signal< type & > & get_signal_add_item()
static SetOf< type > * _globalset
Definition SetOf.hpp:323
std::string get_type_key() const
virtual void Debug() const
Definition SetOf.hpp:296
static type & first_item()
void erase_this_item(type *)
static SetOf< type > & get(const std::string &id)
void set_ID(const std::string &newId)
friend class Domain
Definition SetOf.hpp:238
static std::string class_ID()
Definition SetOf.hpp:245
virtual void add_item_if_not_indexed(SetOf< type > &)
Signal< type & > _signal_add
Definition SetOf.hpp:337
virtual void add_item(type &, bool check=true)
virtual void erase_item(type &)
SetOf(SetOfBase< type > &set, const std::string &id)
std::string type_ID() const
void clear_and_delete_with_progress(const std::string &)
Signal< type & > _signal_erase
Definition SetOf.hpp:338
unsigned int common_item(SetOf< type > &set)
void save(Archive &, const unsigned int) const
void make_union(SetOf< type > &set1, SetOf< type > &set2)
std::istream & read_ascii(std::istream &in)
bool is_equal(SetOf< type > &set)
virtual void add_item(SetOfBase< type > &, bool check=true)
virtual void add_item_if_not_indexed(type &)
static SetOf< type > & get_global_set()
virtual void erase_item_if_indexed(type &)
friend class boost::serialization::access
Definition SetOf.hpp:330
bool include(SetOf< type > &set)
std::ostream & write_ascii(std::ostream &out) const
static SetOf< type > & get_safe(SetOfGeneric *parent)
static bool exist(const std::string &id)
static void add_to_map(SetOf< type > &)
BOOST_SERIALIZATION_SPLIT_MEMBER()
virtual void add_item(type *, bool check=true)
std::vector< Base * > get_allbase_item()
void add_this_item(type *, bool check=true)
SetOfMapBase(const std::string &classID)
Definition SetOfMapBase.cpp:41
SetOfGeneric & get_setofgeneric(const std::string &setID)
SetOfMap< type >::mapType _map
Definition SetOf.hpp:142
void load_it(boost::archive::text_iarchive &, const unsigned int)
void save_it(boost::archive::text_oarchive &, const unsigned int)
bool exist(const std::string &) const
void erase_setof(SetOf< type > &)
std::istream & read_ascii(std::istream &in)
std::map< const std::string, SetOf< type > * > mapType
Definition SetOf.hpp:97
void change_key(const std::string &oldKey, SetOf< type > &set)
SetOf< type > & first_setof()
SetOfMap(const SetOf< type > &)
const SetOf< type > & first_setof() const
std::ostream & write_ascii(std::ostream &out) const
SetOf< type > & get_setof(const std::string &)
std::vector< SetOfGeneric * > get_all_setofgeneric()
void record(boost::archive::text_oarchive &)
BOOST_SERIALIZATION_SPLIT_MEMBER()
void add_setof(SetOf< type > &)
void record(boost::archive::text_iarchive &)
size_t item_number() const
bool is_set_exist(const std::string &setID) const
friend class boost::serialization::access
Definition SetOf.hpp:136
void save(Archive &, const unsigned int) const
static SetOfMap< type > * _the_setof_map
Definition SetOf.hpp:143
SetOfMap< type > & operator=(const SetOfMap< type > &)
void to_vtk(vtkUnstructuredGrid *)
void load(Archive &, const unsigned int)
Definition Singleton.hpp:75
This namespace group the entire Core library.
Definition Common.hpp:198
T type_
Definition SetOf.hpp:232