MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
|
#include <Atom.h>
Public Member Functions | |
bool | IsSane () const |
bool | HasBeenRepaired () |
u32 | GetType () const |
void | Print (ByteSink &ostream) const |
void | WriteStateBits (ByteSink &ostream) const |
void | ReadStateBits (const char *hexStr) |
void | ReadStateBits (const BitVector< BPA > &bv) |
void | WriteBits (ByteSink &ostream) const |
void | ReadBits (const char *hexStr) |
void | XRay (Random &rand, u32 bitOdds) |
bool | operator== (const Atom &rhs) const |
bool | operator!= (const Atom &rhs) const |
Static Public Member Functions | |
static bool | IsType (const T &atom, u32 type) |
static bool | IsSameType (const T &atom, const T &other) |
Protected Attributes | |
BitVector< BPA > | m_bits |
Friends | |
class | VD |
class | Element< CC > |
class | AtomSerializer< CC > |
template<class BV , VD::Type , u32 , u32 > | |
class | BitField |
An Atom is a fixed-size collection of bits, representing an instance of an Element in the Movable Feast Machine. The contents of a site is currently a single Atom.
In general, an Atom is the MFM analog to an 'object' in an object-oriented programming language, as Element is the MFM analog to a 'class'. Be warned, however, that the analogy is very loose! Atoms are both fixed size and very small, comprising dozens or perhaps hundreds of bits only.
The Atom class is abstract; subclasses are to provide details of atomic structure, but note Atom contains NO virtual methods. Our goal is to avoid incurring the cost of a vtable pointer on every Atom instance, so all Atom accesses must be by template type rather than by base class polymorphism.
In addition to the 'virtually virtual' methods that Atom subclasses must provide (i.e., the methods documented as 'This is to be defined only by a subclass of Atom'), Atom subclasses must also provide compile time constants: ATOM_CATEGORY and ATOM_FIRST_STATE_BIT.
|
inline |
|
inline |
|
inlinestatic |
Checks to see if two atoms are of the same type.
atom | One atom to check the type of |
other | The other atom to check the type of |
|
inline |
|
inlinestatic |
Checks to see if a specified Atom is of a particular type.
atom | The atom to check the type of. |
type | The Atomic type to check atom for membership of. |
|
inline |
Reads bits from a ByteSource in hex format, replacing the bits of this Atom with the read bits.
inStream | The ByteSource to read bits from. |
|
inline |
Reads the State bits of this atom from a given hex-encoded char* .