Go to the documentation of this file.
34 #include <boost/format.hpp>
57 relativePos_(0), extraBits_(0), parent_(parent) {
77 : relativePos_(0), extraBits_(0), parent_(parent) {
119 const string procName =
"InstructionField::childField";
120 throw OutOfRange(__FILE__, __LINE__, procName);
136 if (parent == NULL) {
174 const string procName =
"InstructionField::setRelativePosition";
175 throw OutOfRange(__FILE__, __LINE__, procName);
182 int emptyPosition(-1);
183 for (
int i = 0; i < childFields; i++) {
190 if (emptyPosition != -1) {
216 const string procName =
"InstructionField::setExtraBits";
217 throw OutOfRange(__FILE__, __LINE__, procName);
243 const string procName =
"InstructionField::loadState";
249 "Invalid relative position %1%. Should be %2%.");
253 __FILE__, __LINE__,
__func__, errorMsg.str());
258 __FILE__, __LINE__, procName, exception.
errorMessage());
299 typedef list<ObjectState*> OSList;
310 bool inserted =
false;
311 for (OSList::iterator iter = list.begin(); iter != list.end();
316 if (itemPosition > position) {
317 list.insert(iter, child);
323 list.push_back(child);
331 for (OSList::const_iterator iter = list.begin(); iter != list.end();
bool hasAttribute(const std::string &name) const
static const std::string OSKEY_POSITION
ObjectState attribute key for the relative position of the field.
std::string stringAttribute(const std::string &name) const
virtual InstructionField & childField(int position) const
int relativePos_
Indicates the relative position of the field.
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
static NullInstructionField & instance()
virtual ObjectState * saveState() const
#define assert(condition)
virtual int width() const =0
void setParent(InstructionField *parent)
InstructionField * parent() const
ObjectState * child(int index) const
void addChild(ObjectState *child)
static void reorderSubfields(ObjectState *state)
static const std::string OSNAME_INSTRUCTION_FIELD
ObjectState name for instruction field.
void setExtraBits(int bits)
std::string errorMessage() const
virtual int childFieldCount() const =0
void removeChild(ObjectState *child)
virtual void loadState(const ObjectState *state)
int relativePosition() const
int intAttribute(const std::string &name) const
InstructionField * parent_
The parent instruction field.
InstructionField(InstructionField *parent)
void setAttribute(const std::string &name, const std::string &value)
int extraBits_
The number of extra bits.
virtual void setRelativePosition(int position)
virtual ~InstructionField()