Develop Biology
The language of life
bio::physical::Linear Class Reference

#include <Linear.h>

+ Collaboration diagram for bio::physical::Linear:

Public Member Functions

 Linear (Identifiable< StandardDimension > *component, bool shared=false)
 
 ~Linear ()
 
 operator const Identifiable< StandardDimension > * () const
 
 operator Identifiable< StandardDimension > * ()
 
Identifiable< StandardDimension > & operator* ()
 
const Identifiable< StandardDimension > & operator* () const
 
Identifiable< StandardDimension > * operator-> ()
 
const Identifiable< StandardDimension > * operator-> () const
 
bool operator== (const Identifiable< StandardDimension > *component) const
 
bool operator== (const Linear &other) const
 

Protected Attributes

Identifiable< StandardDimension > * m_component
 
bool m_shared
 

Detailed Description

Linear is a ____pointer interface for Biology.

This class is used by Line and chemical::LinearMotifs, see those classes for more info.

Lines contain logic for handling their CONTENT_TYPE by Id, Name, and other aspects innate to the Identifiable<StandardDimension>. The term "linear" comes from the idea that instead of a 0 dimensional pile of objects, as are Arrangements, *this can be ordered along at least 1 dimension (i.e. the StandardDimension).

Current features:

  1. Shared: determines whether or not m_component will be deleted with *this.

Future features:

  1. Const: determines whether or not *this can be changed.

NOTE: Linear is NOT VIRTUAL! This is done to save space in lists. Because we do not need a vtable, we shan't have one!

NOTE: we should support Dimensions other than the StandardDimension. However, the limitations of chemical::Atom::Bonds prevent us from indexing more than 1 template variable from ____Interfaces (e.g. Structure). StandardDimension here, mirrors what is used by chemical::Class and does not require any additional template specialization. Plus, not supporting other Dimensions makes for cleaner inheritance / downstream code. Support for other Dimensions may be added in a future release.

Definition at line 50 of file Linear.h.

Constructor & Destructor Documentation

◆ Linear()

bio::physical::Linear::Linear ( Identifiable< StandardDimension > *  component,
bool  shared = false 
)
Parameters
component
shared

Definition at line 27 of file Linear.cpp.

27 :
28 m_component(component),
29 m_shared(false)
30{
31
32}
Identifiable< StandardDimension > * m_component
Definition: Linear.h:112

◆ ~Linear()

bio::physical::Linear::~Linear ( )

Will delete m_component iff !m_shared.

Definition at line 34 of file Linear.cpp.

35{
36 if (!m_shared && m_component)
37 {
38 delete m_component;
39 }
40}

References m_component, and m_shared.

Member Function Documentation

◆ operator const Identifiable< StandardDimension > *()

bio::physical::Linear::operator const Identifiable< StandardDimension > * ( ) const
Returns
m_component

Definition at line 57 of file Linear.cpp.

58{
59 return m_component;
60}

◆ operator Identifiable< StandardDimension > *()

bio::physical::Linear::operator Identifiable< StandardDimension > * ( )
Returns
m_component

Definition at line 52 of file Linear.cpp.

53{
54 return m_component;
55}

◆ operator*() [1/2]

Identifiable< StandardDimension > & bio::physical::Linear::operator* ( )
Returns
m_component

Definition at line 42 of file Linear.cpp.

43{
44 return *m_component;
45}

References m_component.

◆ operator*() [2/2]

const Identifiable< StandardDimension > & bio::physical::Linear::operator* ( ) const
Returns
m_component

Definition at line 47 of file Linear.cpp.

48{
49 return *m_component;
50}

References m_component.

◆ operator->() [1/2]

Identifiable< StandardDimension > * bio::physical::Linear::operator-> ( )
Returns
m_component

Definition at line 73 of file Linear.cpp.

74{
75 return m_component;
76}

References m_component.

◆ operator->() [2/2]

const Identifiable< StandardDimension > * bio::physical::Linear::operator-> ( ) const
Returns
m_component

Definition at line 78 of file Linear.cpp.

79{
80 return m_component;
81}

References m_component.

◆ operator==() [1/2]

bool bio::physical::Linear::operator== ( const Identifiable< StandardDimension > *  component) const

NOTE: Comparison should be handled by Identifiable, i.e. by Id.

Parameters
component
Returns
whether the component of *this matches the given component.

Definition at line 67 of file Linear.cpp.

68{
69 BIO_SANITIZE(component,, return false)
70 return *m_component == *component;
71}
#define BIO_SANITIZE(test, success, failure)

References BIO_SANITIZE, and m_component.

◆ operator==() [2/2]

bool bio::physical::Linear::operator== ( const Linear other) const

NOTE: Comparison should be handled by Identifiable, i.e. by Id.

Parameters
other
Returns
whether the other's component matches that of *this.

Definition at line 62 of file Linear.cpp.

63{
64 return *m_component == *other.m_component;
65}

References m_component.

Member Data Documentation

◆ m_component

Identifiable< StandardDimension >* bio::physical::Linear::m_component
protected

Definition at line 112 of file Linear.h.

Referenced by ~Linear(), operator*(), operator->(), and operator==().

◆ m_shared

bool bio::physical::Linear::m_shared
protected

Definition at line 113 of file Linear.h.

Referenced by ~Linear().


The documentation for this class was generated from the following files: