Source: OmIntegerNode.h


Annotated List
Files
Globals
Hierarchy
Index
#ifndef OM_INTEGER_NODE_H
#define OM_INTEGER_NODE_H

/**
 * The integer final node structure.
 *
 * This class provides a specialization of OmFinalNode to implement the Integer node construction.
 * This corresponds to a built-in 32 bits integer in base 10 or 16.
 * This is encoded as <OMI> representation </OMI>
 * The list of children must always be empty.
 */
class OmIntegerNode : public OmFinalNode
{
public:
  /**
   * Constructor (can be used as default).
   */
  explicit OmIntegerNode(int value_in=0)
    : value_(value_in) {}

  /**
   * Get the value.
   */
  virtual int getValue() const {
    return value_; }

  /**
   * Set the value.
   */
  virtual void setValue(int value_in) {
    value_ = value_in; }

protected:
  /**
   * Copy constructor.
   */
  OmIntegerNode(const OmIntegerNode & other_in)
    : OmFinalNode(other_in),
      value_(other_in.value_) {}

  /**
   * Destructor.
   */
  virtual ~OmIntegerNode() {}

  /**
   * Implement access to the concrete type.
   */
  virtual OmType typeImp() const {
    return OmIntegerType; }

  /**
   * Implement the deep cloning.
   */
  virtual OmNode * cloneImp() const {
    return new OmIntegerNode(*this); }

  /**
   * Implement the writing to an output device.
   */
  virtual void writeImp(OmOutputDevice & output_in) const {
    output_in.writeInteger(value_); }

  /**
   * Implement the reading from an input device.
   */
  virtual void readImp(OmInputDevice & input_in) {
    input_in.readInteger(value_); }

private:
  int value_;
};

#endif // OM_INTEGER_NODE_H

Generated by: root@localhost.localdomain on Tue Oct 12 21:02:30 199.