torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Vector.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef TORC_GENERIC_VECTOR_HPP
17 #define TORC_GENERIC_VECTOR_HPP
18 
19 #include <algorithm>
20 #include <numeric>
21 #include <vector>
22 
23 //BOOST
24 #ifdef GENOM_SERIALIZATION
25 #include <boost/bind.hpp>
26 #include <boost/mem_fn.hpp>
27 #include <boost/serialization/access.hpp>
28 #include <boost/serialization/base_object.hpp>
29 #include <boost/serialization/vector.hpp>
30 #include <boost/serialization/shared_ptr.hpp>
31 #include <boost/serialization/split_member.hpp>
32 #endif //GENOM_SERIALIZATION
35 #include "torc/generic/Error.hpp"
37 #include "torc/generic/SymTab.hpp"
38 
39 namespace torc {
40 namespace generic {
41 
42 /**
43  * @brief An array of objects.
44  *
45  * This provides methods for accessing and adding elements to the array. It also implements the
46  * VectorPreservation algorithm if cPreserve is set to true. The vector class creates elements
47  * derived from VectorBit class by using the provided factory.
48  */
49 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve = false>
50  class Vector : public virtual Composite<_Type> {
51 #ifdef GENOM_SERIALIZATION
52  friend class boost::serialization::access;
53 #endif //GENOM_SERIALIZATION
54 public:
56  typedef typename BaseType::Type Type;
57  typedef typename BaseType::List List;
58  typedef typename BaseType::Pointer Pointer;
59  typedef typename BaseType::SizeType SizeType;
60  typedef _ChildType ChildType;
61  typedef boost::shared_ptr<ChildType> ChildPointer;
62  typedef _ChildFactoryType ChildFactory;
63  typedef boost::shared_ptr<_ChildFactoryType> ChildFactorySharedPtr;
64 
65 private:
67 
68 protected:
69  Vector();
70 
71 public:
72  virtual ~Vector() throw ();
73 
74  /**
75  * Get composition type for this object
76  *
77  * @return The CompositionType inSource eCompositionTypeVector is returned
78  */
79  virtual CompositionType getCompositionType() const;
80 
81  /**
82  * Get the total number of bits of the composition
83  * @return Number of bits
84  */
85  virtual SizeType getSize() const;
86 
87 #if 0
88  /**
89  * Add a child to the vector at the specified position. Note, that the size of the indices
90  * vector must be same as the dimensions of the array.
91  *
92  * @param[in] inChild A pointer to a child
93  * @param[in] inIndices A list of indices where this item is to be placed in the container vector
94  *
95  * @exception Error The composition is not a container, the child type is not proper or the
96  * dimensions of the indices differ from the dimensions of the array
97  */
98  virtual void addChild(const boost::shared_ptr<Type>& inChild,
99  const std::vector<int>& inIndices) throw(Error);
100 #endif
101 
102  /**
103  * Get a specific member of this composition.
104  *
105  * @note This is relevant for Vector composition only. Other compositions return a NULL pointer
106  *
107  * @param[in] inIndices A list of indices to be accessed. The number of indices must be equal
108  * to the number of dimensions.
109  *
110  * @return A pointer to the child situated at the specified indices. For non-relevant types a
111  * NULL pointer is returned
112  *
113  * @exception Error Index dimensions mismatch
114  * <ul>
115  * <li>
116  * Id : eMessageIdErrorArrayIndexSizeMismatch
117  * </li>
118  * <li> Context Data
119  * <ul>
120  * <li>Array Index Size - <i>size_t</i></li>
121  * <li>Array Dimension Size - <i>size_t</i></li>
122  * </ul>
123  * </li>
124  * </ul>
125  *
126  * @exception Error Array index out of bounds
127  * <ul>
128  * <li>
129  * Id : eMessageIdErrorArrayIndexOutOfBounds
130  * </li>
131  * <li> Context Data
132  * <ul>
133  * <li>Array Index - <i>size_t</i></li>
134  * <li>Array Dimension - <i>size_t</i></li>
135  * </ul>
136  * </li>
137  * </ul>
138  *
139  ** @exception Error Empty Array
140  * <ul>
141  * <li>
142  * Id : eMessageIdErrorEmptyArray
143  * </li>
144  * <li> Context Data
145  * <ul>
146  * <li>Array Dimension - <i>size_t</i></li>
147  * </ul>
148  * </li>
149  * </ul>
150  * </ul>
151  *
152  */
153  virtual const Pointer get(const std::vector<SizeType>& inIndices) const throw (Error);
154 
155  /**
156  * Get children of this composition.
157  *
158  * @param[out] outChildren A list of all children for this composition
159  *
160  * @exception Error If factory is not set and preserve is true and the vector has not been
161  * blasted, an exception is generated.
162  */
163  virtual void getChildren(List& outChildren) const throw (Error);
164 
165  template <typename _Action> void applyOnAllChildren(const _Action& action) throw (Error);
166 
167  virtual void forceAutoBlast(void) throw (Error);
168 
169 protected:
170  /**
171  * Set list of children for unpreserved vector.
172  *
173  * @param[in] inSource List of children
174  */
175  void setChildren(const List& inSource) throw (Error);
176 
177  virtual void onAutoBlast() const throw (Error);
178 
179 public:
180  //This is an implementation convenience function
181  //for derived classes. It returns the list of children
182  //that have already been created in a preserved vector
183  //For an unpreserved vector, use of this function is meaningless
184  //and behavior is same as getChildren() function
185  virtual void getCreatedChildren(List& outChildren) const throw (Error);
186 
187 protected:
188  //This is a function for implementors to do stuff on freshly created children
189  //For example, for preserved vectors (eg. PortRef ) will use this function.
190  //When the portref is already bound and a new bit is created,
191  //it is expected, that the newly created child will be bound to the
192  //corresponding bit of the existing master
193  virtual void onChildCreate(const boost::shared_ptr<ChildType>& inCreatedChild) const
194  throw (Error);
195 
196 public:
197  /**
198  * Create list of children using the provided factory and limits
199  *
200  * @param[in] inFactory ChildFactory to use for construcing children
201  * @param[in] inLimits Array dimensions
202  * @exception Error Children could not be created
203  *
204  * @note setName() must have already been called before calling this method. For preserved
205  * arrays this does not actually do anything other than storing the factory and limits inside
206  * itself for later use.
207  */
208  inline void constructChildren(const boost::shared_ptr<ChildFactory>& inFactory,
209  const std::vector<SizeType>& inLimits) throw (Error);
210 
211 private:
212  inline void autoBlast() const throw (Error);
213 
214  void incrementIndices(std::vector<SizeType>& indices,
215  const std::vector<SizeType>& limits) const;
216 
217  inline SizeType indicesToAbsoluteIndex(const std::vector<SizeType>& inIndices) const;
218 
219  inline SizeType storageSize() const;
220 
221 public:
222  /**
223  * Get dimensions of the array.
224  *
225  * @param[in] outLimits Dimensions of the vector
226  */
227  inline void getLimits(std::vector<SizeType>& outLimits) const;
228 
229  inline bool getIsPreserved() const;
230 
231 protected:
232  /**
233  * Set dimensions of the array.
234  *
235  * @param[in] inSource Dimensions of the vector
236  */
237  void setLimits(const std::vector<SizeType>& inSource);
238 
239  /**
240  * Get current factory
241  *
242  * @return Return ChildFactory object
243  *
244  * @exception Error Null Child Factory
245  * <ul>
246  * <li>
247  * Id : eMessageIdErrorNullChildfactory
248  * </li>
249  * <li> Context Data
250  * <ul>
251  * <li>Child factory - <i>ChildFactory</i></li>
252  * </ul>
253  * </li>
254  *
255 
256  */
257  inline const boost::shared_ptr<ChildFactory> getFactory() const;
258 
259  /**
260  * Set current factory
261  *
262  * @param[in] inSource ChildFactory object
263  */
264  void setFactory(const boost::shared_ptr<ChildFactory>& inSource);
265 
266 private:
267 #ifdef GENOM_SERIALIZATION
268  template <class Archive> void load(Archive& ar, unsigned int);
269 
270  template <class Archive> void save(Archive& ar, unsigned int) const;
271 
272  BOOST_SERIALIZATION_SPLIT_MEMBER()
273 #endif //GENOM_SERIALIZATION
274  std::vector<SizeType> mLimits;
275  mutable List mChildren;
277  boost::shared_ptr<ChildFactory> mFactory;
280 
282 
285 
286 };
287 
288 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
290 
291 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> Vector<
292  _Type, _ChildType, _ChildFactoryType, cPreserve>::Vector() : BaseType(), mLimits(),
293  mChildren(), mFactory(), mIsPreserved(cPreserve), mPreservationThreshold(1024) {}
294 
295 /**
296  * Get composition type for this object
297  *
298  * @return The CompositionType inSource eCompositionTypeVector is returned
299  */
300 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
302  const {
303  return eCompositionTypeVector;
304 }
305 
306 /**
307  * Get the total number of bits of the composition
308  * @return Number of bits
309  */
310 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
312  _ChildType, _ChildFactoryType, cPreserve>::getSize() const {
313  return storageSize();
314 }
315 
316 #if 0
317 
318 /**
319  * Add a child to the vector at the specified position. Note, that the size of the indices vector
320  * must be same as the dimensions of the array.
321  *
322  * @param[in] inChild A pointer to a child
323  * @param[in] inIndices A list of indices where this item is to be placed in the container vector
324  *
325  * @exception Error The composition is not a container, the child type is not proper or the
326  * dimensions of the indices differ from the dimensions of the array
327  */
328 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> void
330  const boost::shared_ptr<Type>& inChild, const std::vector<SizeType>& inIndices) throw(Error) {
331 
332  //Error out if out of limits
333  if(inIndices.size() > mLimits.size()) {
334  //TBD::Error
335  }
336  if(cPreserve && mChildren.empty()) {
337  try {
338  autoBlast();
339  } catch(Error& e) {
340  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__ );
341  throw;
342  }
343  }
344 }
345 
346 #endif
347 
348 /**
349  * Get a specific member of this composition.
350  *
351  * @note This is relevant for Vector composition only. Other compositions return a NULL pointer
352  *
353  * @param[in] inIndices A list of indices to be accessed. The number of indices must be equal to
354  * the number of dimensions.
355  *
356  * @return A pointer to the child situated at the specified indices. For non-relevant types a NULL
357  * pointer is returned
358  *
359  * @exception Error Index dimensions mismatch
360  */
361 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> const
362  typename Vector<_Type, _ChildType, _ChildFactoryType, cPreserve>::Pointer
364  inIndices) const throw (Error) {
365  if(inIndices.size() != mLimits.size()) {
366  Error e(eMessageIdErrorArrayIndexSizeMismatch, __FUNCTION__, __FILE__, __LINE__);
367  e.saveContextData("Array Index", inIndices.size());
368  e.saveContextData("Array Dimension", mLimits.size());
369  throw e;
370  } else {
371  typename std::vector<SizeType>::const_iterator lend = mLimits.end();
372  typename std::vector<SizeType>::const_iterator limit = mLimits.begin();
373  typename std::vector<SizeType>::const_iterator index = inIndices.begin();
374  for(; limit != lend; ++limit, ++index) {
375  if(*index >= *limit) {
376  Error e(eMessageIdErrorArrayIndexOutOfBounds, __FUNCTION__, __FILE__, __LINE__);
377  e.saveContextData("Array Index", *index);
378  e.saveContextData("Array Dimension", *limit);
379  throw e;
380  }
381  }
382  }
383 
384  SizeType index = indicesToAbsoluteIndex(inIndices);
385 
386  Pointer thisPtr = BaseType::getSharedThis();
387  boost::shared_ptr < ChildFactory > factory = getFactory();
388  if(!factory) {
389  Error e(eMessageIdErrorNullChildfactory, __FUNCTION__, __FILE__, __LINE__);
390  e.saveContextData("Null Child Factory", factory);
391  throw e;
392  }
393 
394  Pointer child;
395  if(cPreserve && mChildren.empty()) {
396  if(false == mSparseElements.get(index, child)) {
397  ChildPointer newChild;
398  try {
399  factory->create(newChild);
400  newChild->setParentCollection(thisPtr);
401  newChild->setIndices(inIndices);
402  newChild->setAbsoluteIndex(index);
403  mSparseElements.set(index, newChild);
404  child = newChild;
405  onChildCreate(newChild);
406  } catch(Error& e) {
407  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
408  throw;
409  }
410  }
411  //TBD::THRESHOLD BASED CHECKING?
412  } else {
413  child = mChildren[index];
414  }
415 
416  return child;
417 }
418 
419 /**
420  * Get children of this composition.
421  *
422  * @param[out] outChildren A list of all children for this composition
423  *
424  * @exception Error If factory is not set and preserve is true and the vector has not been
425  * blasted, an exception is generated.
426  */
427 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> void
430  throw (Error) {
431  if(cPreserve //Is the vector preserved? Otherwise it already has all the elements
432  && !mLimits.empty() //Do we have sufficient info to blast
433  && mChildren.empty()) //Haven't we already blasted
434  {
435  try {
436  autoBlast();
437  } catch(Error& e) {
438  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
439  throw;
440  }
441  }
442  outChildren.insert(outChildren.end(), mChildren.begin(), mChildren.end());
443  return;
444 }
445 
446 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
447  template <typename _Action> void Vector<_Type, _ChildType, _ChildFactoryType, cPreserve>
448  ::applyOnAllChildren(const _Action& action) throw (Error) {
449  try {
450  std::for_each(mChildren.begin(), mChildren.end(), action);
451  } catch(Error& e) {
452  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
453  throw;
454  }
455 
456 }
457 
458 /**
459  * Set list of children for unpreserved vector.
460  *
461  * @param[in] inSource List of children
462  */
463 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> void
465  inSource) throw (Error) {
466  mChildren = inSource;
467 }
468 
469 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> void
471  //Do nothing here
472  //meant to be overridden by clients
473 }
474 
475 /**
476  * Force creation of VectorBit children, even if this is a preserved Vector.
477  */
478 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> inline
480  throw (Error) {
481  if(!mFactory) return;
482  if(mLimits.empty()) return;
483  try {
484  autoBlast();
485  } catch(Error& e) {
486  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
487  throw;
488  }
489 }
490 
491 /**
492  * Create list of children using the provided factory and limits
493  *
494  * @param[in] inFactory ChildFactory to use for construcing children
495  * @param[in] inLimits Array dimensions
496  * @exception Error Children could not be created
497  *
498  * @note For preserved arrays this does not actually do anything other than storing the factory and
499  * limits inside itself for later use.
500  */
501 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> inline
503  const boost::shared_ptr<ChildFactory>& inFactory, const std::vector<SizeType>& inLimits)
504  throw (Error) {
505  if(inLimits.empty()) {
506  Error e(eMessageIdErrorEmptyArray, __FUNCTION__, __FILE__, __LINE__);
507  e.saveContextData("Empty Array,", inLimits.empty());
508  throw e;
509  } else {
510  typename std::vector<SizeType>::const_iterator index = inLimits.begin();
511  typename std::vector<SizeType>::const_iterator lend = inLimits.end();
512  for(; index != lend; index++) {
513  if(*index == 0) {
514  Error e(eMessageIdErrorEmptyArray, __FUNCTION__, __FILE__, __LINE__);
515  e.saveContextData("Empty Array,", *index);
516  throw e;
517  }
518  }
519  }
520 
521  setFactory(inFactory);
522  setLimits(inLimits);
523  if(!cPreserve) {
524  try {
525  autoBlast();
526  } catch(Error& e) {
527  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
528  throw;
529  }
530  }
531 }
532 
533 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> inline
535  SizeType size = storageSize();
536  mChildren.resize(mChildren.size() + size); //create empty
537  Pointer thisPtr = BaseType::getSharedThis();
538  std::vector < SizeType > indices(mLimits.size());
539  fill(indices.begin(), indices.end(), 0);
540  if(!thisPtr) {
541  Error e(eMessageIdErrorPointerToItemDoesNotExist, __FUNCTION__, __FILE__, __LINE__);
542  e.saveContextData("Pointer to this object does not exist", thisPtr);
543  throw e;
544  }
545  boost::shared_ptr < ChildFactory > factory = getFactory();
546  if(!factory) {
547  Error e(eMessageIdErrorNullChildfactory, __FUNCTION__, __FILE__, __LINE__);
548  e.saveContextData("Null Child Factory", factory);
549  throw e;
550  }
551  for(SizeType index = 0; index < size; index++) {
552  Pointer child;
553  bool createNew = (cPreserve && mSparseElements.getSize() > 0
554  && mSparseElements.get(index, child)) ? false : true;
555  if(createNew) {
556  ChildPointer newChild;
557  try {
558  factory->create(newChild);
559  newChild->setParentCollection(thisPtr);
560  newChild->setIndices(indices);
561  newChild->setAbsoluteIndex(index);
562  child = newChild;
563  onChildCreate(newChild);
564  } catch(Error& e) {
565  mChildren.clear(); //For consistency
566  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
567  throw;
568  }
569  }
570  incrementIndices(indices, mLimits);
571  mChildren[index] = child;
572  }
573  mSparseElements.clear();
574  try {
575  onAutoBlast();
576  } catch(Error& e) {
577  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
578  throw;
579  }
580 }
581 
582 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> void
584  const throw (Error) {
585  if(cPreserve && mChildren.empty()) {
586  mSparseElements.getValues(outChildren);
587  } else if(!mChildren.empty()) {
588  try {
589  getChildren(outChildren);
590  } catch(Error& e) {
591  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
592  throw;
593  }
594  }
595  return;
596 }
597 
598 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> void
600  const boost::shared_ptr<ChildType>& inCreatedChild) const throw (Error) {
601  //If required, inherited classes will override this
602 }
603 
604 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> void
606  std::vector<SizeType>& indices, const std::vector<SizeType>& limits) const {
607  SizeType size = limits.size();
608  bool incr = false;
609  for(SizeType i = 0; i < size; i++) {
610  if(i == 0 || incr) {
611  ++indices[i];
612  if(indices[i] == limits[i]) {
613  indices[i] = 0;
614  incr = true;
615  } else {
616  incr = false;
617  }
618  }
619  }
620 }
621 
622 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> inline
624  _ChildType, _ChildFactoryType, cPreserve>::indicesToAbsoluteIndex(
625  const std::vector<SizeType>& inIndices) const {
626  SizeType idx = 0;
627  SizeType size = mLimits.size();
628  for(SizeType k = 1; k <= size; k++) {
629  SizeType prod = 1;
630  for(SizeType l = k + 1; l <= size; l++) {
631  prod *= mLimits[l - 1];
632  }
633  idx += prod * inIndices[k - 1];
634  }
635  return idx;
636 }
637 
638 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> inline
641  return std::accumulate(mLimits.begin(), mLimits.end(), 1,
642  std::multiplies<typename Vector<_Type, _ChildType, _ChildFactoryType,
643  cPreserve>::SizeType>());
644 }
645 
646 /**
647  * Get dimensions of the array.
648  *
649  * @return Dimensions of the vector
650  */
651 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> inline
653  std::vector<SizeType>& outLimits) const {
654  outLimits.insert(outLimits.end(), mLimits.begin(), mLimits.end());
655 }
656 
657 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> inline
659  return mIsPreserved;
660 }
661 
662 /**
663  * Set dimensions of the array.
664  *
665  * @param[in] inSource Dimensions of the vector
666  */
667 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> void
669  const std::vector<SizeType>& inSource) {
670  mLimits = inSource;
671 }
672 
673 /**
674  * Get current factory
675  *
676  * @return Return ChildFactory object
677  */
678 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve> inline
679  const boost::shared_ptr<_ChildFactoryType> Vector<_Type, _ChildType, _ChildFactoryType,
680  cPreserve>::getFactory() const {
681  return mFactory;
682 }
683 
684 /**
685  * Set current factory
686  *
687  * @param[in] inSource ChildFactory object
688  */
689 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
691  const boost::shared_ptr<Vector::ChildFactory>& inSource) {
692  mFactory = inSource;
693 }
694 
695 #ifdef GENOM_SERIALIZATION
696 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
698  Archive& ar, unsigned int) {
699  ar & boost::serialization::base_object<BaseType>(*this);
700  ar & mLimits;
701  ar & mChildren;
702  ar & mSparseElements;
703  ar & mIsPreserved;
704  ar & mPreservationThreshold;
705  if(!mChildren.empty()) {
706  for_each(mChildren.begin(), mChildren.end(),
707  boost::bind(boost::mem_fn(&ChildType::setParentCollection), _1,
709  } else {
710  mSparseElements.applyOnAll(boost::bind(boost::mem_fn(&ChildType::setParentCollection), _1,
712  }
713 }
714 
715 template <typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
716  template <class Archive> void Vector<_Type, _ChildType, _ChildFactoryType, cPreserve>::save(
717  Archive& ar, unsigned int) const {
718  ar & boost::serialization::base_object<BaseType>(*this);
719  ar & mLimits;
720  ar & mChildren;
721  ar & mSparseElements;
722  ar & mIsPreserved;
723  ar & mPreservationThreshold;
724 }
725 
726 #endif //GENOM_SERIALIZATION
727 
728 } // namespace generic
729 } // namespace torc
730 
731 #endif // TORC_GENERIC_VECTOR_HPP
virtual void getCreatedChildren(List &outChildren) const
Definition: Vector.hpp:583
SizeType storageSize() const
Definition: Vector.hpp:640
SparseElements mSparseElements
Definition: Vector.hpp:276
std::vector< SizeType > mLimits
Definition: Vector.hpp:274
boost::shared_ptr< ChildType > ChildPointer
Definition: Vector.hpp:61
boost::shared_ptr< ChildFactory > mFactory
Definition: Vector.hpp:277
virtual void onChildCreate(const boost::shared_ptr< ChildType > &inCreatedChild) const
Definition: Vector.hpp:599
SizeType indicesToAbsoluteIndex(const std::vector< SizeType > &inIndices) const
Definition: Vector.hpp:624
Represents the usable instance of a port of a cell in another cell.
virtual void onAutoBlast() const
Definition: Vector.hpp:470
Interface for objects that can be composed within each other.
Definition: Composite.hpp:45
void incrementIndices(std::vector< SizeType > &indices, const std::vector< SizeType > &limits) const
Definition: Vector.hpp:605
virtual CompositionType getCompositionType() const
Definition: Vector.hpp:301
SizeType mPreservationThreshold
Definition: Vector.hpp:279
const boost::shared_ptr< ChildFactory > getFactory() const
Definition: Vector.hpp:680
Composite< _Type > BaseType
Definition: Vector.hpp:55
bool getIsPreserved() const
Definition: Vector.hpp:658
virtual void forceAutoBlast(void)
Definition: Vector.hpp:479
boost::shared_ptr< Type > Pointer
Definition: Composite.hpp:55
void setFactory(const boost::shared_ptr< ChildFactory > &inSource)
Definition: Vector.hpp:690
CompositionType
Defines possible Composition types.
BaseType::SizeType SizeType
Definition: Vector.hpp:59
_ChildFactoryType ChildFactory
Definition: Vector.hpp:62
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
void constructChildren(const boost::shared_ptr< ChildFactory > &inFactory, const std::vector< SizeType > &inLimits)
Definition: Vector.hpp:502
void applyOnAllChildren(const _Action &action)
Definition: Vector.hpp:448
void autoBlast() const
Definition: Vector.hpp:534
Contains definition for CompositionType.
void saveContextData(const std::string &inName, const boost::any &inSource)
Definition: Error.cpp:79
_ChildType ChildType
Definition: Vector.hpp:60
Represents a reference to a bit of a port.
SymTab< SizeType, Pointer > SparseElements
Definition: Vector.hpp:66
An array of objects.
Definition: Vector.hpp:50
virtual const Pointer get(const std::vector< SizeType > &inIndices) const
Definition: Vector.hpp:363
void setLimits(const std::vector< SizeType > &inSource)
Definition: Vector.hpp:668
boost::shared_ptr< _ChildFactoryType > ChildFactorySharedPtr
Definition: Vector.hpp:63
BaseType::Type Type
Definition: Vector.hpp:56
virtual void getChildren(List &outChildren) const
Definition: Vector.hpp:428
void getLimits(std::vector< SizeType > &outLimits) const
Definition: Vector.hpp:652
virtual SizeType getSize() const
Definition: Vector.hpp:312
void setChildren(const List &inSource)
Definition: Vector.hpp:464
BaseType::List List
Definition: Vector.hpp:57
A placeholder for a factory method.
Definition: FactoryType.hpp:35
BaseType::Pointer Pointer
Definition: Vector.hpp:58
Vector< _Type, _ChildType, _ChildFactoryType, cPreserve > & operator=(const Vector< _Type, _ChildType, _ChildFactoryType, cPreserve > &source)
void setCurrentLocation(const std::string &inFunction, const std::string &inFile, uint32_t inLine)
Definition: Error.cpp:73
std::vector< Pointer > List
Definition: Composite.hpp:61