Develop Biology
The language of life
|
#include <ByteStream.h>
Public Member Functions | |
ByteStream () | |
ByteStream (const ByteStream &other) | |
template<typename T > | |
ByteStream (T in) | |
~ByteStream () | |
template<typename T > | |
T | As () |
template<typename T > | |
const T | As () const |
std::size_t | GetSize () const |
std::string | GetTypeName () const |
void * | IKnowWhatImDoing () |
template<typename T > | |
bool | Is () const |
template<typename T > | |
bool | Is (const T &t) const |
bool | IsEmpty () const |
template<typename T > | |
operator const T () const | |
template<typename T > | |
operator T () | |
void | operator= (const ByteStream &other) |
bool | operator== (const ByteStream &other) const |
void | Release () |
void | Set (const ByteStream &other) |
template<typename T > | |
void | Set (T in) |
Protected Attributes | |
bool | m_holding |
std::size_t | m_size |
void * | m_stream |
std::string | m_typeName |
Generic byte stream class. Kinda like a void* that you can save and cast later. Work around for c++98 auto keyword and other wonky problems.
DO NOT USE THIS IMPROPERLY!!
If you don't understand what this does and how it CAN GO HORRIBLY WRONG, DO NOT USE THIS CLASS!
This is used by BIO_SANITIZE_WITH_CACHE and Containers.
NOTE: ByteStreams are not virtual to save what space we can. This may change in a future release if we decide we somehow need more hacky, abstract storage.
Definition at line 47 of file ByteStream.h.
bio::ByteStream::ByteStream | ( | ) |
DON'T USE THIS UNLESS YOU KNOW WHAT YOU'RE DOING
Definition at line 26 of file ByteStream.cpp.
|
inline |
Definition at line 56 of file ByteStream.h.
References Set().
bio::ByteStream::ByteStream | ( | const ByteStream & | other | ) |
bio::ByteStream::~ByteStream | ( | ) |
Definition at line 40 of file ByteStream.cpp.
References Release().
|
inline |
Casts stored data to T.
T |
Definition at line 89 of file ByteStream.h.
References BIO_ASSERT, and m_stream.
|
inline |
Casts stored data to T.
T |
Definition at line 106 of file ByteStream.h.
References BIO_ASSERT, and m_stream.
std::size_t bio::ByteStream::GetSize | ( | ) | const |
Definition at line 73 of file ByteStream.cpp.
References m_size.
std::string bio::ByteStream::GetTypeName | ( | ) | const |
Definition at line 68 of file ByteStream.cpp.
References m_typeName.
void * bio::ByteStream::IKnowWhatImDoing | ( | ) |
Assume the caller knows something we don't. Please don't use this.
Definition at line 78 of file ByteStream.cpp.
References m_stream.
Referenced by bio::genetic::Insertion::Seek(), and bio::genetic::Localization::Seek().
|
inline |
Check if Set was called with T.
T |
Definition at line 183 of file ByteStream.h.
References m_size, and m_typeName.
Referenced by bio::physical::Arrangement< TYPE >::Add(), bio::physical::Arrangement< TYPE >::AreEqual(), and bio::physical::Line::AreEqual().
|
inline |
Auto template determining version of Is<T>().
T |
t | only used for automatically determining T. |
Definition at line 195 of file ByteStream.h.
bool bio::ByteStream::IsEmpty | ( | ) | const |
Check if *this has been Set.
Definition at line 63 of file ByteStream.cpp.
References m_stream.
|
inline |
Casts stored data to T.
T |
Definition at line 134 of file ByteStream.h.
|
inline |
Casts stored data to T.
T |
Definition at line 123 of file ByteStream.h.
void bio::ByteStream::operator= | ( | const ByteStream & | other | ) |
other |
Definition at line 45 of file ByteStream.cpp.
References m_holding, m_size, m_stream, m_typeName, Release(), and Set().
bool bio::ByteStream::operator== | ( | const ByteStream & | other | ) | const |
Compares the memory contained in both *this and other.
other |
Definition at line 108 of file ByteStream.cpp.
References m_size, m_stream, and m_typeName.
void bio::ByteStream::Release | ( | ) |
Frees the memory this was Holding. Nop if *this was not holding anything. NOTE: This does not call any destructors. You must do that yourself. (i.e. there is no typename -> new type -> union -> delete; delete)
Definition at line 96 of file ByteStream.cpp.
References m_holding, m_size, m_stream, and m_typeName.
Referenced by ~ByteStream(), and operator=().
void bio::ByteStream::Set | ( | const ByteStream & | other | ) |
Copies the data from an other into *this and Holds it.
Definition at line 83 of file ByteStream.cpp.
References m_holding, m_size, m_stream, and m_typeName.
|
inline |
Copies the data given to a new memory location. This should be used if the provided "in" is expected to go out of scope but the value still be valid. Make sure you Release *this to delete the stored content.
T |
in | data to store |
Definition at line 147 of file ByteStream.h.
References m_size, m_stream, and m_typeName.
Referenced by ByteStream(), bio::chemical::ExcitationWithoutArgument< WAVE, RETURN >::CallDown(), bio::chemical::ExcitationWithArgument< WAVE, RETURN, ARGUMENT >::CallDown(), bio::chemical::ExcitationWithTwoArguments< WAVE, RETURN, ARGUMENT1, ARGUMENT2 >::CallDown(), operator=(), bio::physical::Filterable::Spin(), bio::physical::Periodic::Spin(), and bio::physical::Quantum< T >::Spin().
|
protected |
Definition at line 221 of file ByteStream.h.
Referenced by operator=(), Release(), and Set().
|
protected |
Definition at line 220 of file ByteStream.h.
Referenced by GetSize(), Is(), operator=(), operator==(), Release(), and Set().
|
protected |
Definition at line 218 of file ByteStream.h.
Referenced by As(), IKnowWhatImDoing(), IsEmpty(), operator=(), operator==(), Release(), and Set().
|
protected |
Definition at line 219 of file ByteStream.h.
Referenced by GetTypeName(), Is(), operator=(), operator==(), Release(), and Set().