degate  0.1.2
Public Types | Public Member Functions | Private Attributes
degate::ObjectSet Class Reference

#include <ObjectSet.h>

Inheritance diagram for degate::ObjectSet:
Inheritance graph
[legend]

List of all members.

Public Types

typedef std::set
< PlacedLogicModelObject_shptr,
LMOCompare
object_set_type
typedef
object_set_type::const_iterator 
const_iterator
typedef object_set_type::iterator iterator

Public Member Functions

virtual ~ObjectSet ()
virtual void clear ()
virtual void add (PlacedLogicModelObject_shptr object)
virtual void remove (PlacedLogicModelObject_shptr object)
size_t size () const
const_iterator begin () const
const_iterator end () const
iterator begin ()
iterator end ()
bool empty () const
bool contains (PlacedLogicModelObject_shptr o) const
bool check_for_all (bool(*check_function)(PlacedLogicModelObject_shptr)) const
 Check if all objects evaluate to true for a check.
template<typename ObjectType >
std::shared_ptr< ObjectType > get_single_object () const

Private Attributes

object_set_type objects

Detailed Description

Definition at line 48 of file ObjectSet.h.


Member Typedef Documentation

typedef object_set_type::const_iterator degate::ObjectSet::const_iterator

Definition at line 52 of file ObjectSet.h.

typedef object_set_type::iterator degate::ObjectSet::iterator

Definition at line 53 of file ObjectSet.h.

Definition at line 51 of file ObjectSet.h.


Constructor & Destructor Documentation

virtual degate::ObjectSet::~ObjectSet ( ) [inline, virtual]

Definition at line 59 of file ObjectSet.h.

{}

Member Function Documentation

void ObjectSet::add ( PlacedLogicModelObject_shptr  object) [virtual]

Reimplemented in degate::HlObjectSet.

Definition at line 45 of file ObjectSet.cc.

                                                       {
  objects.insert(object);
}

Definition at line 66 of file ObjectSet.h.

References objects.

{ return objects.begin(); }

Definition at line 68 of file ObjectSet.h.

References objects.

{ return objects.begin(); }
bool degate::ObjectSet::check_for_all ( bool(*)(PlacedLogicModelObject_shptr check_function) const [inline]

Check if all objects evaluate to true for a check.

If there are no objects, false is returned.

Definition at line 78 of file ObjectSet.h.

References empty(), and objects.

                                                                                   {
      if(empty()) return false;

      BOOST_FOREACH(PlacedLogicModelObject_shptr o, objects) {
        if(check_function(o) == false) return false;
      }
      return true;
    }

Here is the call graph for this function:

void ObjectSet::clear ( ) [virtual]

Reimplemented in degate::HlObjectSet.

Definition at line 40 of file ObjectSet.cc.

                      {
  objects.clear();
}

Definition at line 73 of file ObjectSet.h.

References objects.

{ return objects.find(o) != objects.end(); }
bool degate::ObjectSet::empty ( ) const [inline]

Definition at line 71 of file ObjectSet.h.

References objects.

Referenced by check_for_all().

{ return objects.empty(); }

Here is the caller graph for this function:

Definition at line 67 of file ObjectSet.h.

References objects.

{ return objects.end(); }

Definition at line 69 of file ObjectSet.h.

References objects.

{ return objects.end(); }
template<typename ObjectType >
std::shared_ptr<ObjectType> degate::ObjectSet::get_single_object ( ) const [inline]

Definition at line 88 of file ObjectSet.h.

References objects, and size().

                                                          {
      std::shared_ptr<ObjectType> o;

      if(size() == 1) {
        const_iterator it = objects.begin();
        if(o = std::dynamic_pointer_cast<ObjectType>(*it)) return o;
      }
      return o;
    }

Here is the call graph for this function:

void ObjectSet::remove ( PlacedLogicModelObject_shptr  object) [virtual]

Reimplemented in degate::HlObjectSet.

Definition at line 50 of file ObjectSet.cc.

                                                          {

  object_set_type::iterator it = find(objects.begin(), objects.end(), object);

  if(it != objects.end()) {
    objects.erase(it);
  }
}
size_t degate::ObjectSet::size ( ) const [inline]

Definition at line 64 of file ObjectSet.h.

References objects.

Referenced by get_single_object().

{ return objects.size(); }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 56 of file ObjectSet.h.

Referenced by begin(), check_for_all(), contains(), empty(), end(), get_single_object(), and size().


The documentation for this class was generated from the following files: