C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2
reference_item.h File Reference

Reference counter (of an object owners). More...

#include <math_define.h>
#include <system_types.h>
#include <templ_rp_array.h>
#include <templ_s_array.h>
#include <templ_sptr.h>
#include <system_cpp_standard.h>
#include <system_dependency.h>
#include <tool_memory_leaks_check.h>
#include <mb_variables.h>
#include <vector>

Classes

class  MbRefItem
 Reference-counted object. More...
 
class  MbSerialItem< Type >
 Serialization class template (ordinal numbering of created objects). More...
 

Namespaces

 c3d
 C3D namespace declaration.
 

Enumerations

enum  MbeRefType {
  rt_RefItem = 0 , rt_PlaneItem , rt_SpaceItem , rt_TopItem ,
  rt_Creator , rt_Attribute , rt_Primitive
}
 Types of object with reference counter. More...
 

Functions

template<class Type >
void DeleteMatItem (Type *&item)
 Delete an object without references.
 
template<class Vector >
void DeleteMatItems (Vector &items)
 Delete objects without references.
 
template<class Type >
Type & DuplicateIfUsed (Type &item)
 Create a copy if object is used, otherwise return original.
 
template<class Type , class RegType >
Type & DuplicateIfUsed (Type &item, RegType *iReg)
 Create a copy if object is used, otherwise return original.
 
template<class Type >
Type * DuplicateIfUsed (SPtr< Type > &item)
 Create a copy if object is used, otherwise return original.
 
template<class Type , class RegType >
Type * DuplicateIfUsed (SPtr< Type > &item, RegType *iReg)
 Create a copy if object is used, otherwise return original.
 
template<class Type >
void DeleteItem (Type *&item)
 Delete an object if it is unnecessary.
 
template<class Type >
void ReleaseItem (Type *&item)
 Release the reference to object.
 
template<class Type >
void AddRefItem (const Type *item)
 Catch an object.
 
template<class Type >
void DecRefItem (const Type *item)
 Detach an object without removing.
 
template<class ItemsVector >
void AddRefItems (const ItemsVector &items)
 Catch objects.
 
template<class ItemsVector >
void DecRefItems (const ItemsVector &items)
 Detach objects without removing.
 
template<class ItemsVector >
void DeleteItems (ItemsVector &items)
 Remove unnecessary objects.
 
template<class ItemsVector >
void ReleaseItems (ItemsVector &items)
 Detach objects with possible removing.
 
template<class ItemsVector , class coType >
void DeleteItems (ItemsVector &items, SArray< coType > &coItems)
 Remove unnecessary objects.
 
template<class ItemsVector , class coType >
void DeleteItems (ItemsVector &items, std::vector< coType > &coItems)
 Remove unnecessary objects.
 
template<class ItemsVector , class coType >
void ReleaseItems (ItemsVector &items, SArray< coType > &coItems)
 Detach objects with possible removing.
 
template<class ItemsVector , class coType >
void ReleaseItems (ItemsVector &items, std::vector< coType > &coItems)
 Detach objects with possible removing.
 
template<class TypeVector , class Type >
void AddRefItems (const TypeVector &srcItems, bool same, RPArray< Type > &dstItems)
 Put elements with capturing and with possible copying.
 
template<class TypeVector , class Type >
void AddRefItems (const TypeVector &srcItems, bool same, std::vector< SPtr< Type > > &dstItems)
 Put elements with capturing and with possible copying.
 
template<class TypeVector , class Type >
void AddRefItems (const TypeVector &srcItems, bool same, std::vector< Type * > &dstItems)
 Put elements with capturing and with possible copying.
 
template<class TypeVector , class Type , class RegType >
void AddRefRegItems (const TypeVector &srcItems, bool same, RPArray< Type > &dstItems, RegType *iReg)
 Put elements with capturing and with possible copying.
 
template<class TypeVector , class Type , class RegType >
void AddRefRegItems (const TypeVector &srcItems, bool same, std::vector< SPtr< Type > > &dstItems, RegType *iReg)
 Put elements with capturing and with possible copying.
 
template<class TypeVector , class Type , class RegType >
void AddRefRegItems (const TypeVector &srcItems, bool same, std::vector< Type * > &dstItems, RegType *iReg)
 Put elements with capturing and with possible copying.
 
template<class Item >
bool IsItemSame (const Item *item1, const Item *item2, double accuracy)
 Determine whether the objects are similar.
 
template<class Vector >
bool AreItemsSame (const Vector &items1, const Vector &items2, double accuracy)
 Determine whether the objects are similar.
 
template<class Vector >
bool AreObjectsSame (const Vector &items1, const Vector &items2, double accuracy)
 Determine whether the objects are similar.
 
template<class Vector >
bool AreItemsSimilar (const Vector &items1, const Vector &items2)
 Determine whether the objects are similar.
 
template<class Vector >
bool SetItemsEqual (const Vector &srcItems, Vector &dstItems)
 Make equal.
 
template<class TypeVector , class Type , class RegType >
void DuplicateItems (const TypeVector &srcItems, RegType *iReg, bool same, RPArray< Type > &dstItems)
 Duplicate with registrator (optionally put originals).
 
template<class TypeVector , class Type , class RegType >
void DuplicateItems (const TypeVector &srcItems, RegType *iReg, bool same, std::vector< SPtr< Type > > &dstItems)
 Duplicate with registrator (optionally put originals).
 
template<class TypeVector , class Type , class RegType >
void DuplicateItems (const TypeVector &srcItems, RegType *iReg, bool same, std::vector< Type * > &dstItems)
 Duplicate with registrator (optionally put originals).
 
template<class Array , class Matrix , class RegType >
void TransformItems (Array &items, const Matrix &matr, RegType *iReg)
 Transform elements according to the matrix.
 
template<class Array , class Matrix >
void TransformItems (Array &items, const Matrix &matr)
 Transform elements according to the matrix.
 
template<class Array , class Matrix >
void TransformObjects (Array &objects, const Matrix &matr)
 Transform elements according to the matrix.
 
template<class Array , class Vector , class RegType >
void MoveItems (Array &items, const Vector &to, RegType *iReg)
 Translate objects along a vector.
 
template<class Array , class Vector >
void MoveItems (Array &items, const Vector &to)
 Translate objects along a vector.
 
template<class Array , class Vector >
void MoveObjects (Array &objects, const Vector &to)
 Translate objects along a vector.
 
template<class Array , class Axis , class RegType >
void RotateItems (Array &items, const Axis &axis, double angle, RegType *iReg)
 Rotate about an axis.
 
template<class Array , class Axis >
void RotateItems (Array &items, const Axis &axis, double angle)
 Rotate about an axis.
 
template<class Array , class Axis >
void RotateObjects (Array &objects, const Axis &axis, double angle)
 Rotate about an axis.
 
template<class Vector , class Writer >
void WriteRefItems (const Vector &items, Writer &out)
 Write objects to the stream.
 
template<class Type , class Writer >
void WriteRefItems (const std::vector< SPtr< Type > > &items, Writer &out)
 Write objects to the stream.
 
template<class Type , class Reader >
void ReadRefItems (Reader &in, RPArray< Type > &items)
 Read an array of objects with capturing from the stream.
 
template<class Type , class Reader >
void ReadRefItems (Reader &in, std::vector< Type * > &items)
 Read an array of objects with capturing from the stream.
 
template<class Type , class Reader >
void ReadRefItems (Reader &in, std::vector< SPtr< Type > > &items)
 Read an array of objects with capturing from the stream.
 
template<class Vector >
void ReleaseAndDetachItem_ (Vector &items, size_t index)
 Detach from array and decrease reference counter. More...
 
template<class Vector , class Type >
void AddRefAndAddItem_ (Vector &items, Type *newItem)
 Add an object and increase reference counter. More...
 
template<class Vector , class Type >
void AddRefAndAddAtItem_ (Vector &items, Type *newItem, size_t index)
 Add an object and increase reference counter. More...
 
template<class Type >
void ReleaseAndDetachItem_ (std::vector< SPtr< Type > > &items, size_t index)
 Detach from array and decrease reference counter. More...
 
template<class Type >
void AddRefAndAddItem_ (std::vector< SPtr< Type > > &items, Type *newItem)
 Add an object and increase reference counter. More...
 
template<class Type >
void AddRefAndAddAtItem_ (std::vector< SPtr< Type > > &items, Type *newItem, size_t index)
 Add an object and increase reference counter. More...
 
template<class Type >
Type * DetachItem (SPtr< Type > &itemOwner)
 Detach object from owning pointer.
 
template<class Type >
void ReplaceByCopy (Type *&item)
 Replace object by copy.
 
template<class Objects , class Gab >
void AddYourGabaritTo (Objects &objects, Gab &gab)
 Include bounding boxes of an array of objects in a common bounding box.
 

Detailed Description

Reference counter (of an object owners).

Function Documentation

◆ ReleaseAndDetachItem_() [1/2]

template<class Vector >
void ReleaseAndDetachItem_ ( Vector &  items,
size_t  index 
)

Detach from array and decrease reference counter.

Detach from array and decrease reference counter without checks.

Parameters
[in,out]items- An array of elements.
[in]index- Index of element. Isn't checked for correctness.

◆ AddRefAndAddItem_() [1/2]

template<class Vector , class Type >
void AddRefAndAddItem_ ( Vector &  items,
Type *  newItem 
)

Add an object and increase reference counter.

Add an object and increase reference counter without checks.

Parameters
[in,out]items- An array of elements.
[in]newItem- New element.

◆ AddRefAndAddAtItem_() [1/2]

template<class Vector , class Type >
void AddRefAndAddAtItem_ ( Vector &  items,
Type *  newItem,
size_t  index 
)

Add an object and increase reference counter.

Add an object and increase reference counter without checks.

Parameters
[in,out]items- An array of elements.
[in]newItem- New element.
[in]index- Index of element. Isn't checked for correctness.

◆ ReleaseAndDetachItem_() [2/2]

template<class Type >
void ReleaseAndDetachItem_ ( std::vector< SPtr< Type > > &  items,
size_t  index 
)

Detach from array and decrease reference counter.

Detach from array and decrease reference counter without checks.

Parameters
[in,out]items- An array of elements.
[in]index- Index of element. Isn't checked for correctness.

◆ AddRefAndAddItem_() [2/2]

template<class Type >
void AddRefAndAddItem_ ( std::vector< SPtr< Type > > &  items,
Type *  newItem 
)

Add an object and increase reference counter.

Add an object and increase reference counter without checks.

Parameters
[in,out]items- An array of elements.
[in]newItem- New element.

◆ AddRefAndAddAtItem_() [2/2]

template<class Type >
void AddRefAndAddAtItem_ ( std::vector< SPtr< Type > > &  items,
Type *  newItem,
size_t  index 
)

Add an object and increase reference counter.

Add an object and increase reference counter without checks.

Parameters
[in,out]items- An array of elements.
[in]newItem- New element.
[in]index- Index of element. Isn't checked for correctness.