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"
Definition: Domain.hpp:46
Definition: ExtendedSetOf.hpp:44
Definition: SetOf.hpp:346
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 > &)
std::list< SetOf< type > * > & get_setof_list()
SetOf< type > & _globalset
Definition: SetOf.hpp:375
unsigned long long int get_numeric_ID() const
Definition: SetOf.hpp:153
virtual void clear_and_delete()
virtual void add_item(std::vector< type * > &vector, bool check=true)
bool contain(const type &item) const
std::vector< type * >::iterator begin()
std::vector< type * >::iterator end()
const type * operator[](size_t i) const
size_t get_rank(const type *item) 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()
const type * get_item_by_rank(size_t i) const
virtual void erase_item(type *item)
void save(Archive &ar, const unsigned int version) const
const type & last() const
bool contain(const type *item) const
const std::vector< type * > & get_vector() const
type * operator[](size_t i)
virtual void add_item(type &item, bool check=true)
type * get_item_by_rank(size_t i)
const type & first() const
virtual void add_item(SetOfBase< type > &, bool check=true)
size_t get_rank(const type &item) const
type & operator()(size_t i)
std::vector< type * >::const_iterator begin() const
virtual void add_item(type *item, bool check=true)
type & get_item(size_t i)
void load(Archive &ar, const unsigned int version)
std::vector< type * > _item_vector
Definition: SetOf.hpp:216
friend class boost::serialization::access
Definition: SetOf.hpp:219
const type & get_item(size_t i) const
const type & operator()(size_t i) const
Definition: SetOfGeneric.hpp:46
Definition: SetOf.hpp:236
bool is_global_set() const
void add_item_in_class_hierarchy(type *, SetOfGeneric *)
static SetOf< type > & pull(const std::string &id)
std::istream & read_ascii(std::istream &in)
SetOf(const std::string &id)
static type & first_item()
SetOf< typename type::base > * _childset
Definition: SetOf.hpp:336
void erase_item_in_class_hierarchy(type *, SetOfGeneric *)
void make_difference(SetOf< type > &set1, SetOf< type > &set2)
std::ostream & write_ascii(std::ostream &out) const
virtual void add_item(std::vector< type * > &, bool check=true)
static void delete_from_map(SetOf< type > &)
void load(Archive &, const unsigned int)
static SetOf< type > & get(const std::string &id)
static std::string get_global_str_key()
Definition: SetOf.hpp:246
static SetOf< type > & get()
Signal< type & > & get_signal_erase_item()
void make_intersection(SetOf< type > &set1, SetOf< type > &set2)
static SetOf< type > & get_global_set()
virtual void erase_item(type *)
bool has_intersection(SetOf< type > &set)
static SetOf< type > * _globalset
Definition: SetOf.hpp:323
std::string get_type_key() const
std::vector< Base * > get_allbase_item()
virtual void Debug() const
Definition: SetOf.hpp:296
void erase_this_item(type *)
static type & get_item_by_base_class_rank(size_t i)
static SetOf< type > & get_setof_by_ID(const std::string &id)
void set_ID(const std::string &newId)
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
Signal< type & > & get_signal_add_item()
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
SetOf< typename type::base > * get_base_class_set(SetOfGeneric *)
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)
static SetOf< type > & get_safe(SetOfGeneric *parent)
bool is_equal(SetOf< type > &set)
virtual void add_item(SetOfBase< type > &, bool check=true)
virtual void add_item_if_not_indexed(type &)
virtual void erase_item_if_indexed(type &)
static void * get_item_by_base_class_rank(size_t i, size_t classID)
friend class boost::serialization::access
Definition: SetOf.hpp:330
bool include(SetOf< type > &set)
static SetOf< type > * get_setof_ptr_by_ID(const std::string &id)
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)
void add_this_item(type *, bool check=true)
Definition: SetOfMapBase.hpp:50
SetOfMap< type >::mapType _map
Definition: SetOf.hpp:142
void load_it(boost::archive::text_iarchive &, const unsigned int)
std::istream & read_ascii(std::istream &in)
void save_it(boost::archive::text_oarchive &, const unsigned int)
std::ostream & write_ascii(std::ostream &out) const
bool exist(const std::string &) const
void erase_setof(SetOf< type > &)
std::map< const std::string, SetOf< type > * > mapType
Definition: SetOf.hpp:97
void change_key(const std::string &oldKey, SetOf< type > &set)
std::vector< SetOfGeneric * > get_all_setofgeneric()
SetOfMap(const SetOf< type > &)
void record(boost::archive::text_oarchive &)
BOOST_SERIALIZATION_SPLIT_MEMBER()
void add_setof(SetOf< type > &)
SetOfGeneric & get_setofgeneric(const std::string &setID)
void record(boost::archive::text_iarchive &)
size_t item_number() const
bool is_set_exist(const std::string &setID) const
SetOf< type > & first_setof()
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
const SetOf< type > & first_setof() const
SetOf< type > & get_setof(const std::string &)
void to_vtk(vtkUnstructuredGrid *)
SetOfMap< type > & operator=(const SetOfMap< type > &)
void load(Archive &, const unsigned int)
Definition: Singleton.hpp:75
Definition: Common.hpp:198
Definition: SetOf.hpp:232
T type_
Definition: SetOf.hpp:232