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

#include <Line.h>

+ Inheritance diagram for bio::physical::Line:
+ Collaboration diagram for bio::physical::Line:

Public Member Functions

 Line (Index expectedSize=2)
 
virtual ~Line ()
 
ByteStream Access (const Index index)
 
const ByteStream Access (const Index index) const
 
virtual bool AreEqual (Index internal, const ByteStream external) const
 
virtual Identifiable< StandardDimension > * LinearAccess (Index index)
 
virtual const Identifiable< StandardDimension > * LinearAccess (Index index) const
 
virtual Index SeekToId (StandardDimension id)
 
virtual Index SeekToName (Name name)
 
- Public Member Functions inherited from bio::physical::Arrangement< Linear >
 Arrangement (const Index expectedSize=2)
 
virtual ~Arrangement ()
 
ByteStream Access (const Index index)
 
const ByteStream Access (const Index index) const
 
Index Add (const ByteStream content)
 
virtual bool AreEqual (Index internal, const ByteStream external) const
 
bool Erase (const Index index)
 
virtual const std::size_t GetStepSize () const
 
virtual Linear OptimizedAccess (Index index)
 
virtual const Linear OptimizedAccess (Index index) const
 
- Public Member Functions inherited from bio::Container
 Container (const Container &other)
 
 Container (const Index expectedSize=2, std::size_t stepSize=sizeof(ByteStream))
 
virtual ~Container ()
 
virtual ByteStream Access (const Index index)
 
virtual const ByteStream Access (const Index index) const
 
ByteStream Access (const SmartIterator itt)
 
virtual const ByteStream Access (const SmartIterator itt) const
 
virtual Index Add (const ByteStream content)
 
template<typename T >
std::vector< T > AsVector () const
 
virtual SmartIterator Begin () const
 
virtual void Clear ()
 
virtual IteratorConstructClassIterator (const Index index=InvalidIndex()) const
 
virtual SmartIterator End () const
 
bool Erase (const SmartIterator itt)
 
virtual bool Erase (Index index)
 
virtual void Expand ()
 
virtual Index GetAllocatedSize () const
 
virtual Index GetBeginIndex () const
 
virtual Index GetCapacity () const
 
virtual Index GetEndIndex () const
 
virtual Index GetNumberOfElements () const
 
bool Has (const ByteStream content) const
 
virtual void Import (const Container *other)
 
virtual Index Insert (const ByteStream content, const Index index)
 
virtual bool IsAllocated (const Index index) const
 
virtual bool IsFree (const Index index) const
 
virtual bool IsInRange (const Index index) const
 
virtual ByteStream operator[] (const Index index)
 
virtual const ByteStream operator[] (const Index index) const
 
virtual ByteStream operator[] (const SmartIterator itt)
 
virtual const ByteStream operator[] (const SmartIterator itt) const
 
Index SeekTo (const ByteStream content) const
 

Additional Inherited Members

- Protected Member Functions inherited from bio::Container
virtual bool AreEqual (Index internal, const ByteStream external) const
 
virtual Index GetNextAvailableIndex ()
 
virtual const std::size_t GetStepSize () const
 
- Protected Attributes inherited from bio::Container
std::deque< Indexm_deallocated
 
Index m_firstFree
 
Index m_size
 
unsigned char * m_store
 
Iteratorm_tempItt
 

Detailed Description

Lines are Linear Arrangements.

NOTE: We reserve Position 0 as invalid.

Template Parameters
STORE

Definition at line 37 of file Line.h.

Constructor & Destructor Documentation

◆ Line()

bio::physical::Line::Line ( Index  expectedSize = 2)
Parameters
expectedSize

Definition at line 28 of file Line.cpp.

◆ ~Line()

bio::physical::Line::~Line ( )
virtual

Definition at line 35 of file Line.cpp.

36{
37
38}

Member Function Documentation

◆ Access() [1/2]

ByteStream bio::physical::Line::Access ( const Index  index)
virtual

We want to return an Identifiable< StandardDimension >*, not a Linear.

Parameters
index
Returns
an Identifiable< StandardDimension >* from the Linear at the given Index.

Reimplemented from bio::Container.

Definition at line 40 of file Line.cpp.

41{
42 return Cast< Identifiable< StandardDimension >* >(OptimizedAccess(index));
43}
virtual Linear OptimizedAccess(Index index)
Definition: Arrangement.h:128

References bio::physical::Arrangement< Linear >::OptimizedAccess().

◆ Access() [2/2]

const ByteStream bio::physical::Line::Access ( const Index  index) const
virtual

We want to return an Identifiable< StandardDimension >*, not a Linear.

Parameters
index
Returns
an Identifiable< StandardDimension >* from the Linear at the given Index.

Reimplemented from bio::Container.

Definition at line 45 of file Line.cpp.

46{
47 return Cast< Identifiable< StandardDimension >* >(OptimizedAccess(index));
48}

References bio::physical::Arrangement< Linear >::OptimizedAccess().

◆ AreEqual()

bool bio::physical::Line::AreEqual ( Index  internal,
const ByteStream  external 
) const
virtual

Since we operate on Identifiable< StandardDimension >*, not Linears, we want to treat the external datum as Identifiable< StandardDimension >*.

Parameters
internal
external
Returns
whether or not the Linear at the given Index is equal to the provided Identifiable< StandardDimension >*.

Reimplemented from bio::physical::Arrangement< Linear >.

Definition at line 50 of file Line.cpp.

51{
52 BIO_SANITIZE(external.Is< Identifiable< StandardDimension >* >(),,return false)
53 return OptimizedAccess(internal) == external.template As< const Identifiable< StandardDimension >* >();
54}
#define BIO_SANITIZE(test, success, failure)

References BIO_SANITIZE, bio::ByteStream::Is(), and bio::physical::Arrangement< Linear >::OptimizedAccess().

◆ LinearAccess() [1/2]

Identifiable< StandardDimension > * bio::physical::Line::LinearAccess ( Index  index)
virtual

Convenience wrapper around OptimizedAccess.

Parameters
index
Returns
the given position casted to an Identifiable< StandardDimension >*

Definition at line 56 of file Line.cpp.

57{
58 return OptimizedAccess(index);
59}

References bio::physical::Arrangement< Linear >::OptimizedAccess().

Referenced by SeekToId(), and SeekToName().

◆ LinearAccess() [2/2]

const Identifiable< StandardDimension > * bio::physical::Line::LinearAccess ( Index  index) const
virtual

Convenience wrapper around OptimizedAccess.

Parameters
index
Returns
the given position casted to an Identifiable< StandardDimension >*

Definition at line 61 of file Line.cpp.

62{
63 return OptimizedAccess(index);
64}

References bio::physical::Arrangement< Linear >::OptimizedAccess().

◆ SeekToId()

Index bio::physical::Line::SeekToId ( StandardDimension  id)
virtual

Get the position of an Identifiable< StandardDimension >* with the given id in *this.

Parameters
id
Returns
an Index matching the given id or InvalidIndex().

Definition at line 83 of file Line.cpp.

84{
85 if (!m_tempItt)
86 {
88 }
90 for (; !m_tempItt->IsAtBeginning(); --m_tempItt)
91 {
92 if (LinearAccess(m_tempItt->GetIndex())->IsId(id))
93 {
94 return m_tempItt->GetIndex();
95 }
96 }
97 return InvalidIndex();
98}
virtual Iterator * ConstructClassIterator(const Index index=InvalidIndex()) const
Definition: Container.cpp:285
Iterator * m_tempItt
Definition: Container.h:350
virtual Index GetEndIndex() const
Definition: Container.cpp:69
bool MoveTo(const Index index)
Definition: Iterator.cpp:48
virtual bool IsAtBeginning() const
Definition: Iterator.cpp:58
Index GetIndex() const
Definition: Iterator.cpp:43
virtual Identifiable< StandardDimension > * LinearAccess(Index index)
Definition: Line.cpp:56
const Index InvalidIndex()
Definition: Types.cpp:26

References bio::Container::ConstructClassIterator(), bio::Container::GetEndIndex(), bio::Iterator::GetIndex(), bio::InvalidIndex(), bio::Iterator::IsAtBeginning(), LinearAccess(), bio::Container::m_tempItt, and bio::Iterator::MoveTo().

◆ SeekToName()

Index bio::physical::Line::SeekToName ( Name  name)
virtual

Get the position of an Identifiable< StandardDimension >* with the given name in *this.

Parameters
name
Returns
an Index matching the given name or InvalidIndex().

Definition at line 66 of file Line.cpp.

67{
68 if (!m_tempItt)
69 {
71 }
73 for (; !m_tempItt->IsAtBeginning(); --m_tempItt)
74 {
75 if (LinearAccess(m_tempItt->GetIndex())->IsName(name))
76 {
77 return m_tempItt->GetIndex();
78 }
79 }
80 return InvalidIndex();
81}

References bio::Container::ConstructClassIterator(), bio::Container::GetEndIndex(), bio::Iterator::GetIndex(), bio::InvalidIndex(), bio::Iterator::IsAtBeginning(), LinearAccess(), bio::Container::m_tempItt, and bio::Iterator::MoveTo().


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