Develop Biology
The language of life
bio Namespace Reference

Namespaces

namespace  bond_type
 
namespace  cellular
 
namespace  chemical
 
namespace  code
 
namespace  filter
 
namespace  genetic
 
namespace  log
 
namespace  molecular
 
namespace  organic
 
namespace  physical
 
namespace  property
 
namespace  random
 
namespace  state
 
namespace  string
 
namespace  symmetry_type
 
namespace  transcription_factor
 
namespace  utility
 

Classes

class  ByteStream
 
class  Container
 
class  Iterator
 
class  SmartIterator
 
class  Threaded
 
class  ThreadSafe
 
class  VirtualBase
 

Typedefs

typedef std::vector< ByteStreamByteStreams
 
typedef std::vector< const char * > CharStrings
 
typedef uint32_t Index
 
typedef const char * Name
 
typedef std::vector< NameNames
 
typedef std::vector< std::string > StdStrings
 
typedef uint32_t TimeMS
 
typedef uint32_t TimeSec
 
typedef uint32_t Timestamp
 
typedef std::vector< TimestampTimestamps
 
typedef uint32_t TimeUS
 
typedef void TypeNameProber
 

Enumerations

enum  Position {
  TOP = 0 , BOTTOM , AFTER , BEFORE ,
  INSERTION_POSITION_TOTAL
}
 

Functions

 BIO_ID (Site, uint8_t) BIO_PERSPECTIVE_SINGLETON(LocalizationSitePerspective
 
 BIO_ID (StandardDimension, uint32_t) BIO_ID_WITH_PERSPECTIVE(Code
 
uint8_t BIO_ID_WITH_PERSPECTIVE (State, uint8_t) BIO_ID_WITH_PERSPECTIVE_WITH_PLURAL(Property
 
uint8_t uint8_t BIO_ID_WITH_PERSPECTIVE (SymmetryType, uint8_t) BIO_ID_WITH_PERSPECTIVE(Filter
 
Site BIO_PERSPECTIVE_SINGLETON (InsertionSitePerspective, Site) BIO_ID_WITH_PERSPECTIVE(TranscriptionFactor
 
 BIO_PERSPECTIVE_SINGLETON (OrganismPerspective, StandardDimension) BIO_PERSPECTIVE_SINGLETON(HabitatPerspective
 
 BIO_SITE_FUNCTION_BODY (InSurface, molecular::Molecule *) BIO_SITE_FUNCTION_BODY(OnMolecule
 
 BIO_STRONG_TYPEDEF (uint8_t, BondType, 0) BIO_PERSPECTIVE_SINGLETON(BondTypePerspective
 
template<typename TO , typename FROM >
TO Cast (FROM toCast)
 
template<typename TO , typename FROM >
TO ChemicalCast (FROM toCast)
 
template<typename T >
CloneAndCast (const T toClone)
 
template<typename TO_FINAL , typename TO_1 , typename FROM >
TO_FINAL DoubleForceCast (FROM toCast, TO_1 *autoTo)
 
template<typename TO , typename FROM >
TO ForceCast (FROM toCast)
 
const Index InvalidIndex ()
 
template<typename T >
const std::string TypeName ()
 
template<typename T >
static const std::string TypeName ()
 
template<typename T >
const std::string TypeName (const T t)
 
template<>
const std::string TypeName< void > ()
 
template<typename T >
static const std::string WrappedTypeName ()
 
static const std::size_t WrappedTypeNamePrefixLength ()
 
static const std::size_t WrappedTypeNameSuffixLength ()
 

Variables

uint8_t Properties
 

Detailed Description

the random namespace provides functions for generating random numbers. IMPORTANT: random is currently only implemented in c++11. When not using c++ >= 11, 0 is returned.

Common string operations

File of common types used across many classes.

WARNING: THIS FILE USES C++11 for cross platform time management. TODO: add C++98 compatibility for popular operating systems.

Typedef Documentation

◆ ByteStreams

typedef std::vector< ByteStream > bio::ByteStreams

Definition at line 52 of file Types.h.

◆ CharStrings

typedef std::vector< const char* > bio::CharStrings

Definition at line 49 of file Types.h.

◆ Index

typedef uint32_t bio::Index

Indices are used by Arrangements to manage and manipulate what they store.

Definition at line 57 of file Types.h.

◆ Name

typedef const char* bio::Name

Names are used in NameTracker<>s but are defined here for simplicity.

Definition at line 46 of file Types.h.

◆ Names

typedef std::vector< Name > bio::Names

Definition at line 47 of file Types.h.

◆ StdStrings

typedef std::vector< std::string > bio::StdStrings

Definition at line 50 of file Types.h.

◆ TimeMS

typedef uint32_t bio::TimeMS

milliseconds (ms for short)

Definition at line 79 of file Types.h.

◆ TimeSec

typedef uint32_t bio::TimeSec

seconds (s or sec for short)

Definition at line 84 of file Types.h.

◆ Timestamp

typedef uint32_t bio::Timestamp

milliseconds (ms for short)

Definition at line 68 of file Types.h.

◆ Timestamps

typedef std::vector< Timestamp > bio::Timestamps

Definition at line 69 of file Types.h.

◆ TimeUS

typedef uint32_t bio::TimeUS

microseconds (us for short)

Definition at line 74 of file Types.h.

◆ TypeNameProber

typedef void bio::TypeNameProber

Used to determine magic numbers in extracting symbols as type.

Definition at line 49 of file TypeName.h.

Enumeration Type Documentation

◆ Position

Mainly used for inserting children into Nested classes.

Enumerator
TOP 
BOTTOM 
AFTER 
BEFORE 
INSERTION_POSITION_TOTAL 

Definition at line 45 of file Types.h.

46{
47 TOP = 0,
48 BOTTOM,
49 AFTER,
50 BEFORE,
52} Position;
Position
Definition: Types.h:46
@ AFTER
Definition: Types.h:49
@ BOTTOM
Definition: Types.h:48
@ TOP
Definition: Types.h:47
@ BEFORE
Definition: Types.h:50
@ INSERTION_POSITION_TOTAL
Definition: Types.h:51

Function Documentation

◆ BIO_ID() [1/2]

bio::BIO_ID ( Site  ,
uint8_t   
)

Sites are types of places. The place itself should be specified by Name or Id. Because places can be anything, we rely on Perspective::AssociateType and chemical::Excitation in order to turn a Site into an actionable function. Sites are identical to Sites except they have an insertion method, rather than an extraction method. See Localization.h for more info.

◆ BIO_ID() [2/2]

bio::BIO_ID ( StandardDimension  ,
uint32_t   
)

Id type used for all Ids until Named classes can be properly derived from. See physical::Identifiable.h for more info. StandardDimension is NOT used when the type itself is the id, e.g. for Code, etc. Value returned by many bio methods. You may make your own Codes by using the macro defined in common/Codes.h

◆ BIO_ID_WITH_PERSPECTIVE() [1/2]

uint8_t bio::BIO_ID_WITH_PERSPECTIVE ( State  ,
uint8_t   
)

States determine the condition of an object (e.g. a chemical::Substance) at runtime. The most common State is Enabled() (see "bio/chemical/States.h") Properties are feature flags that give some hint of what a Wave can do (i.e. be cast as). For example, having the Periodic() Property means the class derives from Periodic and thus implements the Peak() method. You might not know that the derived Wave included inheritance of Periodic without being able to ProbeFor() the Periodic Property. See Wave.h for more info.

While the State of an object might change often, the Properties should remain constant. However, that is not enforced. The properties of water change when its chemical state changes from liquid to solid, so the Properties of your objects could change in whatever way you'd like, though doing so is generally not recommended.

◆ BIO_ID_WITH_PERSPECTIVE() [2/2]

uint8_t uint8_t bio::BIO_ID_WITH_PERSPECTIVE ( SymmetryType  ,
uint8_t   
)

SymmetryTypes determine what to do with a particular Symmetry. They should contain the generic building blocks of all Axes (e.g. programming languages) such that Waves can be Spun around any Axis.

References BIO_PERSPECTIVE_SINGLETON().

◆ BIO_PERSPECTIVE_SINGLETON() [1/2]

Site bio::BIO_PERSPECTIVE_SINGLETON ( InsertionSitePerspective  ,
Site   
)

TranscriptionFactors determine which Proteins are expressed in which Cells. They exist as unique numbers only, which are added to Expressors in order to direct Plasmid expression on startup. For example, if you want to add functionality to a Cell, you would start by defining YourFavoritePlasmid (genetic::Plasmid), which contains YourFavoriteProtein (cellular::Protein). You would then specify which TranscriptionFactors are required for YourFavoriteProtein in YourFavoriteGene. Once that is done, you can add the previous TranscriptionFactor to any number of Cells, all of which will begin expressing YourFavoriteProtein on startup. TranscriptionFactors thus allow you to pick and choose which features of your loaded modules you would like in your Cells. In practice, you'll likely be using other people's Plasmids, so TranscriptionFactors give you a level of control over how you want to consume external libraries in your networks.

Referenced by BIO_ID_WITH_PERSPECTIVE().

◆ BIO_PERSPECTIVE_SINGLETON() [2/2]

bio::BIO_PERSPECTIVE_SINGLETON ( OrganismPerspective  ,
StandardDimension   
)

◆ BIO_SITE_FUNCTION_BODY()

bio::BIO_SITE_FUNCTION_BODY ( InSurface  ,
molecular::Molecule  
)

◆ BIO_STRONG_TYPEDEF()

bio::BIO_STRONG_TYPEDEF ( uint8_t  ,
BondType  ,
 
)

The BondType of an Atom::Bond provides a simple description of the nature of the Bond. This can be used to inform other systems (e.g. molecular) of how to treat the Bonded Wave. NOTE: Atoms can Bond things that are not Atoms. The only requirement is that they are Wave.

◆ Cast()

template<typename TO , typename FROM >
TO bio::Cast ( FROM  toCast)

Simple casting wrapper. It continues to function when RTTI is disabled.

Template Parameters
TO
FROMDynamically determined template type.
Parameters
toCasta FROM.
Returns
toCast as a TO

Definition at line 35 of file Cast.h.

36{
37 #ifdef RTTI_ENABLED
38 return dynamic_cast<TO>(toCast);
39 #else
40 return (TO)(toCast);
41 //Is reinterpret_cast the appropriate substitute here? Need to check usages.
42 #endif
43}

◆ ChemicalCast()

template<typename TO , typename FROM >
TO bio::ChemicalCast ( FROM  toCast)

Definition at line 31 of file Cast.h.

32{
33 return toCast->AsAtom()->template As< TO >();
34}

◆ CloneAndCast()

template<typename T >
T bio::CloneAndCast ( const T  toClone)

Ease of use method for Cloning.

Template Parameters
T
Returns
a Clone of T casted to back to T.

Definition at line 42 of file Cast.h.

43{
44 //Dereference here might be dangerous & need sanitization.
45 return ChemicalCast< T, ::bio::physical::Wave* >(toClone->Clone()->AsWave());
46}

◆ DoubleForceCast()

template<typename TO_FINAL , typename TO_1 , typename FROM >
TO_FINAL bio::DoubleForceCast ( FROM  toCast,
TO_1 *  autoTo 
)

DANGEROUS!!! Same as ForceCast, except uses a dummy parameter to automatically determine an intermediate type.

Template Parameters
TODynamically determined by autoTo dummy parameter.
FROMDynamically determined template type.
Parameters
toCasta FROM.
autoTodummy.
Returns
toCast as a TO, regardless of what it was before.

Definition at line 76 of file Cast.h.

80{
81 return (TO_FINAL)(TO_1)(void*)(toCast);
82}

◆ ForceCast()

template<typename TO , typename FROM >
TO bio::ForceCast ( FROM  toCast)

DANGEROUS!!!

DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING!

THIS DOES NO ERROR CHECKING AND WILL BREAK YOUR CODE IF MISUSED!

Example use case: void* toCast = new MyClass(); //void* might be an ambiguous base class but MyClass is the same for toCast and casted. MyClass* casted = ForceCast<MyClass*>(toCast);

Template Parameters
TO
FROMDynamically determined template type.
Parameters
toCasta FROM.
Returns
toCast as a TO, regardless of what it was before.

Definition at line 61 of file Cast.h.

62{
63 return (TO)(void*)(toCast);
64}

◆ InvalidIndex()

const Index bio::InvalidIndex ( )

We sacrifice our first index for the ability to do error checking.

Returns
a Index that holds no content.

Definition at line 26 of file Types.cpp.

27{
28 return 0;
29}

Referenced by bio::physical::Arrangement< TYPE >::Add(), bio::Container::GetNextAvailableIndex(), bio::Container::Insert(), bio::chemical::LinearMotif< CONTENT_TYPE >::InsertImplementation(), bio::Container::SeekTo(), bio::physical::Line::SeekToId(), and bio::physical::Line::SeekToName().

◆ TypeName() [1/3]

template<typename T >
const std::string bio::TypeName ( )

FORWARD DECLARATION

Template Parameters
T
Returns
Just T as a string.

◆ TypeName() [2/3]

template<typename T >
static const std::string bio::TypeName ( )
static

Converts the T symbol to a string.

Template Parameters
T
Returns
Just T as a string.

Definition at line 95 of file TypeName.h.

96{
97 static const std::string wrappedName = WrappedTypeName< T >();
98 static const std::size_t prefixLength = WrappedTypeNamePrefixLength();
99 static const std::size_t suffixLength = WrappedTypeNameSuffixLength();
100 static const std::size_t typeNameLength = wrappedName.length() - prefixLength - suffixLength;
101 return wrappedName.substr(
102 prefixLength,
103 typeNameLength
104 );
105}
static const std::size_t WrappedTypeNamePrefixLength()
Definition: TypeName.h:75
static const std::size_t WrappedTypeNameSuffixLength()
Definition: TypeName.h:84

References WrappedTypeNamePrefixLength(), and WrappedTypeNameSuffixLength().

◆ TypeName() [3/3]

template<typename T >
const std::string bio::TypeName ( const T  t)

Converts the T symbol to a string.

Template Parameters
T
Parameters
tused for auto type determination.
Returns
Just T as a string.

Definition at line 114 of file TypeName.h.

115{
116 return TypeName< T >();
117}

◆ TypeName< void >()

template<>
const std::string bio::TypeName< void > ( )
inline
Returns
"void"

Definition at line 41 of file TypeName.h.

42{
43 return "void";
44}

◆ WrappedTypeName()

template<typename T >
static const std::string bio::WrappedTypeName ( )
static

Converts the T symbol to a string. Only supported on a limited number of compilers.

Template Parameters
T
Returns
T as a string with wrapping symbols.

Definition at line 58 of file TypeName.h.

59{
60 #ifdef __clang__
61 return __PRETTY_FUNCTION__;
62 #elif defined(__GNUC__)
63 return __PRETTY_FUNCTION__;
64 #elif defined(_MSC_VER)
65 return __FUNCSIG__;
66 #else
67 #error "Unsupported compiler"
68 #endif
69}

◆ WrappedTypeNamePrefixLength()

static const std::size_t bio::WrappedTypeNamePrefixLength ( )
static

Used to trim leading characters from symbol string.

Returns
magic number for prefix length.

Definition at line 75 of file TypeName.h.

76{
77 return WrappedTypeName< TypeNameProber >().find(TypeName< TypeNameProber >());
78}

Referenced by TypeName(), and WrappedTypeNameSuffixLength().

◆ WrappedTypeNameSuffixLength()

static const std::size_t bio::WrappedTypeNameSuffixLength ( )
static

Used to trim trailing characters from symbol string.

Returns
magic number for suffix length.

Definition at line 84 of file TypeName.h.

85{
86 return WrappedTypeName< TypeNameProber >().length() - WrappedTypeNamePrefixLength() - TypeName< TypeNameProber >().length();
87}

References WrappedTypeNamePrefixLength().

Referenced by TypeName().

Variable Documentation

◆ Properties