30 #ifndef _LibPhysic_Pair_H
31 #define _LibPhysic_Pair_H
44 template<
typename type>
60 Pair(type& p1, type& p2);
72 std::ostream&
write_ascii (std::ostream& out)
const;
74 std::string
info()
const;
83 template<
class Archive>
void serialize(Archive&,
const unsigned int);
93 template<
typename type> std::map<const type*, SetOfBase<Pair<type> > >
96 template<
typename type>
void
98 _connectivity_map.clear();
100 for (
auto& it: set) {
101 _connectivity_map[&it->item1_].add_item(it);
102 _connectivity_map[&it->item2_].add_item(it);
108 AssertMsg(_connectivity_map.size() > 0,
"The connectivity map is null, you must update the connectivity map before");
109 AssertMsg(_connectivity_map.count(&item) == 1,
"Can't find the required item in the connectivity map, maybe you need to update it before");
110 return _connectivity_map[&item];
113 template<
typename type>
unsigned int
115 AssertMsg(_connectivity_map.size() > 0,
"The connectivity map is null, you must update the connectivity map before");
116 if (_connectivity_map.count(&item) == 0)
119 return _connectivity_map[&item].size();
122 template<
typename type>
124 : item1_(p1), item2_(p2) {
127 template<
typename type>
131 template<
typename type> type&
136 template<
typename type>
const type&
141 template<
typename type> type&
146 template<
typename type>
const type&
151 template<
typename type> type&
156 template<
typename type> type&
161 template<
typename type> std::string
163 std::ostringstream os;
164 os <<
"pair between "
172 template<
typename type> std::ostream&
174 out << item1_.numID() <<
'\t' << item2_.numID();
178 template<
typename type> std::istream&
183 template<
typename type>
void
188 template<
typename type>
189 template<
class Archive>
192 ar & boost::serialization::base_object<Base>(*
this);
203 namespace serialization
206 template<
typename type,
class Archive>
209 const unsigned int) {
210 const type* item1 = &
t->get_item1();
211 const type* item2 = &
t->get_item2();
216 template<
typename type,
class Archive>
219 const unsigned int) {
220 type* item1 =
nullptr;
221 type* item2 =
nullptr;
#define AssertMsg(condition, message)
Definition: Macro.hpp:67
Base & item()
Definition: Base.hpp:237
std::istream & read_ascii(std::istream &in)
Definition: Pair.hpp:179
static std::map< const type *, SetOfBase< Pair< type > > > _connectivity_map
Definition: Pair.hpp:86
void serialize(Archive &, const unsigned int)
Definition: Pair.hpp:191
type & get_item1()
Definition: Pair.hpp:132
Pair(const Pair &)=delete
std::string info() const
Definition: Pair.hpp:162
static unsigned int get_number_of_connection_for(const type &item)
Definition: Pair.hpp:114
static SetOfBase< Pair< type > > & get_connection_for(const type &)
Definition: Pair.hpp:107
type & item1_
Definition: Pair.hpp:89
std::ostream & write_ascii(std::ostream &out) const
Definition: Pair.hpp:173
static void update_connectivity_map()
Definition: Pair.hpp:97
type & item1()
Definition: Pair.hpp:152
void draw()
Definition: Pair.hpp:184
type & item2()
Definition: Pair.hpp:157
friend class boost::serialization::access
Definition: Pair.hpp:82
type & get_item2()
Definition: Pair.hpp:142
Pair(type &p1, type &p2)
Definition: Pair.hpp:123
~Pair()
Definition: Pair.hpp:128
type & item2_
Definition: Pair.hpp:90
Pair & operator=(const Pair &)=delete
Definition: PropClass.hpp:47
Definition: SetOf.hpp:346
unsigned long long int get_numeric_ID() const
Definition: SetOf.hpp:153
Definition: SetOf.hpp:236
static type & get_item_by_base_class_rank(size_t i)
Definition: Common.hpp:198
void save_construct_data(Archive &ar, const GranOO3::Core::Pair< type > *t, const unsigned int)
Definition: Pair.hpp:207
void load_construct_data(Archive &ar, GranOO3::Core::Pair< type > *t, const unsigned int)
Definition: Pair.hpp:217
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t t(t+t)") define_sfop3(16
static Base * new_object(const std::string &classID, std::istream &in)
Definition: Pair.hpp:240
Definition: SetOfManager.hpp:63