Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

TAO_Notify_EventChannelFactory Class Reference

Implementation of CosNotifyChannelAdmin::EventChannelFactory. More...

#include <EventChannelFactory.h>

Inheritance diagram for TAO_Notify_EventChannelFactory:
Inheritance graph
[legend]
Collaboration diagram for TAO_Notify_EventChannelFactory:
Collaboration graph
[legend]

List of all members.

Public Types

typedef
TAO_Notify_Refcountable_Guard_T
< TAO_Notify_EventChannelFactory
Ptr

Public Member Functions

 TAO_Notify_EventChannelFactory (void)
 Constructor.
void init (PortableServer::POA_ptr poa)
 Init the factory.
virtual ~TAO_Notify_EventChannelFactory ()
 Destructor.
virtual void _add_ref (void)
 = ServantBase Methods
virtual void _remove_ref (void)
virtual void remove (TAO_Notify_EventChannel *channel)
 Remove channel from the <ec_container_>
virtual
CosNotifyChannelAdmin::EventChannel_ptr 
create_named_channel (const CosNotification::QoSProperties &initial_qos, const CosNotification::AdminProperties &initial_admin, CosNotifyChannelAdmin::ChannelID_out id, const char *name)
void load_topology (void)
void set_topology_factory (TAO_Notify::Topology_Factory *sf)
virtual bool is_persistent (void) const
 Should this object be saved?
virtual void save_persistent (TAO_Notify::Topology_Saver &saver)
virtual bool change_to_parent (void)
 Send change to parent.
virtual
TAO_Notify::Topology_Object
load_child (const ACE_CString &type, CORBA::Long id, const TAO_Notify::NVPList &attrs)
 Create a child of the appropriate type and return it.
CosNotifyChannelAdmin::EventChannelFactory_ptr activate_self (void)
virtual void reconnect (void)
virtual void validate ()
void stop_validator (void)
 at shutdown time, this causes the validator thread to exit.
bool handle_change (void)
 Handle change notifications.
void load_event_persistence (void)
virtual void save_topology (void)
TAO_Notify_ProxyConsumerfind_proxy_consumer (TAO_Notify::IdVec &id_path, size_t position)
TAO_Notify_ProxySupplierfind_proxy_supplier (TAO_Notify::IdVec &id_path, size_t position)
TAO_Notify_Objectfollow_id_path (TAO_Notify::IdVec &id_path, size_t position)
virtual TAO_Notify_Object::ID get_id (void) const
 Find the id associated with topology object.

Protected Member Functions

virtual
::CosNotifyChannelAdmin::EventChannel_ptr 
create_channel (const CosNotification::QoSProperties &initial_qos, const CosNotification::AdminProperties &initial_admin, CosNotifyChannelAdmin::ChannelID_out id)
 = CosNotifyChannelAdmin Methods
virtual
::CosNotifyChannelAdmin::ChannelIDSeq
get_all_channels (void)
virtual
::CosNotifyChannelAdmin::EventChannel_ptr 
get_event_channel (CosNotifyChannelAdmin::ChannelID id)

Private Types

typedef ACE_Unbounded_Set
< TAO_Notify::Routing_Slip_Ptr
Routing_Slip_Set
typedef TAO_Notify_Container_T
< TAO_Notify_EventChannel
TAO_Notify_EventChannel_Container

Private Member Functions

virtual void destroy (void)
 = Data Members
virtual int shutdown (void)
 shutdown
virtual
NotifyExt::ReconnectionRegistry::ReconnectionID 
register_callback (NotifyExt::ReconnectionCallback_ptr reconnection)
virtual void unregister_callback (NotifyExt::ReconnectionRegistry::ReconnectionID id)
virtual CORBA::Boolean is_alive (void)
TAO_Notify_EventChannel_Containerec_container ()
virtual void release (void)
 Release this object.

Private Attributes

ACE_Auto_Ptr
< TAO_Notify_EventChannel_Container
ec_container_
 Container for Event Channels.
TAO_SYNCH_MUTEX topology_save_lock_
CosNotifyChannelAdmin::EventChannelFactory_var channel_factory_
short topology_save_seq_
 Change-in-progress detector to avoid duplicates.
TAO_Notify::Topology_Factorytopology_factory_
TAO_Notify::Reconnection_Registry reconnect_registry_
bool loading_topology_
Routing_Slip_Set routing_slip_restart_set_
ACE_Auto_Ptr
< TAO_Notify_validate_client_Task
validate_client_task_
PortableServer::POA_var poa_

Friends

class TAO_Notify_Builder

Detailed Description

Implementation of CosNotifyChannelAdmin::EventChannelFactory.

Definition at line 52 of file EventChannelFactory.h.


Member Typedef Documentation

Definition at line 60 of file EventChannelFactory.h.

Definition at line 57 of file EventChannelFactory.h.

Definition at line 159 of file EventChannelFactory.h.


Constructor & Destructor Documentation

TAO_Notify_EventChannelFactory::TAO_Notify_EventChannelFactory ( void   ) 

Constructor.

Definition at line 55 of file EventChannelFactory.cpp.

TAO_Notify_EventChannelFactory::~TAO_Notify_EventChannelFactory (  )  [virtual]

Destructor.

Definition at line 63 of file EventChannelFactory.cpp.

{
}


Member Function Documentation

void TAO_Notify_EventChannelFactory::_add_ref ( void   )  [virtual]

= ServantBase Methods

Definition at line 138 of file EventChannelFactory.cpp.

{
  this->_incr_refcnt ();
}

void TAO_Notify_EventChannelFactory::_remove_ref ( void   )  [virtual]

Definition at line 144 of file EventChannelFactory.cpp.

{
  this->_decr_refcnt ();
}

CosNotifyChannelAdmin::EventChannelFactory_ptr TAO_Notify_EventChannelFactory::activate_self ( void   ) 

Definition at line 508 of file EventChannelFactory.cpp.

{
  CORBA::Object_var obj = this->activate (this);
  this->channel_factory_
    = CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in());

  try
  {
    if (DEBUG_LEVEL > 9)
    {
      ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) TAO_Notify_EventChannelFactory::activate_self\n") ));
    }
    this->reconnect ();
  }
  catch (const CORBA::Exception&)
  {
    // ignore for now
  }
  return this->channel_factory_._retn();
}

bool TAO_Notify_EventChannelFactory::change_to_parent ( void   )  [virtual]

Send change to parent.

Override this if you don't expect to have a parent (top level of tree) private virtual because this should only be called from send_change()

Returns:
false if save will never happen

Reimplemented from TAO_Notify::Topology_Object.

Definition at line 345 of file EventChannelFactory.cpp.

{
  bool saving = false;
  if (! this->loading_topology_)
  {
    // A null pointer means that saving of topology is disabled.
    if (this->topology_factory_ != 0)
    {
      saving = true;
      // seq is used to check save-in-progress
      // if it changes while we're waiting for the lock
      // then our change may have already been saved, so
      // just return.  Caller will signal change again if necessary.
      short seq = this->topology_save_seq_;
      ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->topology_save_lock_, CORBA::INTERNAL ());
      if (seq == this->topology_save_seq_)
      {
        auto_ptr<TAO_Notify::Topology_Saver> saver(this->topology_factory_->create_saver());
        if (saver.get() != 0)
        {
          this->save_persistent(*saver);
          saver->close ();
        }
        this->topology_save_seq_ += 1;
      }
    }
  }
  return saving;
}

CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::create_channel ( const CosNotification::QoSProperties initial_qos,
const CosNotification::AdminProperties initial_admin,
CosNotifyChannelAdmin::ChannelID_out  id 
) [protected]

= CosNotifyChannelAdmin Methods

Definition at line 188 of file EventChannelFactory.cpp.

{
  CosNotifyChannelAdmin::EventChannel_var ec =
    TAO_Notify_PROPERTIES::instance()->builder()->build_event_channel (this
                                                                        , initial_qos
                                                                        , initial_admin
                                                                        , id);
  this->self_change ();
  return ec._retn ();
}

CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::create_named_channel ( const CosNotification::QoSProperties initial_qos,
const CosNotification::AdminProperties initial_admin,
CosNotifyChannelAdmin::ChannelID_out  id,
const char *  name 
) [virtual]

This method is called by the Notify_Service when the event channel is automatically created and bound in the name service.

Definition at line 178 of file EventChannelFactory.cpp.

{
  return this->create_channel (initial_qos, initial_admin, id);
}

void TAO_Notify_EventChannelFactory::destroy ( void   )  [private, virtual]

= Data Members

= NotifyExt methods

Definition at line 68 of file EventChannelFactory.cpp.

{
  if (this->shutdown () == 1)
    return;

  TAO_Notify_Properties* properties = TAO_Notify_PROPERTIES::instance();

  // Reset references to CORBA objects.
  properties->orb (CORBA::ORB::_nil ());
  properties->default_poa (PortableServer::POA::_nil ());

  ec_container_.reset( 0 );
}

TAO_Notify_EventChannelFactory::TAO_Notify_EventChannel_Container & TAO_Notify_EventChannelFactory::ec_container (  )  [private]

Definition at line 537 of file EventChannelFactory.cpp.

{
  ACE_ASSERT( this->ec_container_.get() != 0 );
  return *ec_container_;
}

TAO_Notify_ProxyConsumer * TAO_Notify_EventChannelFactory::find_proxy_consumer ( TAO_Notify::IdVec id_path,
size_t  position 
)

Definition at line 457 of file EventChannelFactory.cpp.

{
  TAO_Notify_ProxyConsumer * result = 0;
  size_t path_size = id_path.size ();

  // EventChannelFactory only:  The first id is proably for the ECF itself
  // if so, silently consume it.
  if (position < path_size && id_path[position] == this->id())
  {
    ++position;
  }
  if (position < path_size)
  {
    TAO_Notify_EventChannel_Find_Worker find_worker;

    TAO_Notify_EventChannel * ec = find_worker.find (id_path[position], this->ec_container());
    ++position;
    if (ec != 0)
    {
      result = ec->find_proxy_consumer (id_path, position);
    }
  }
  return result;
}

TAO_Notify_ProxySupplier * TAO_Notify_EventChannelFactory::find_proxy_supplier ( TAO_Notify::IdVec id_path,
size_t  position 
)

Definition at line 483 of file EventChannelFactory.cpp.

{
  TAO_Notify_ProxySupplier * result = 0;
  size_t path_size = id_path.size ();

  // EventChannelFactory only:  The first id is proably for the ECF itself
  // if so, silently consume it.
  if (position < path_size && id_path[position] == this->id())
  {
    ++position;
  }
  if (position < path_size)
  {
    TAO_Notify_EventChannel_Find_Worker find_worker;
    TAO_Notify_EventChannel * ec = find_worker.find (id_path[position], this->ec_container());
    ++position;
    if (ec != 0)
    {
      result = ec->find_proxy_supplier (id_path, position);
    }
  }
  return result;
}

TAO_Notify_Object* TAO_Notify_EventChannelFactory::follow_id_path ( TAO_Notify::IdVec id_path,
size_t  position 
)
CosNotifyChannelAdmin::ChannelIDSeq * TAO_Notify_EventChannelFactory::get_all_channels ( void   )  [protected]

Definition at line 204 of file EventChannelFactory.cpp.

{
  TAO_Notify_EventChannel_Seq_Worker seq_worker;

  return seq_worker.create (this->ec_container());
}

CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::get_event_channel ( CosNotifyChannelAdmin::ChannelID  id  )  [protected]

Definition at line 212 of file EventChannelFactory.cpp.

{
  TAO_Notify_EventChannel_Find_Worker find_worker;

  return find_worker.resolve (id, this->ec_container());
}

TAO_Notify_Object::ID TAO_Notify_EventChannelFactory::get_id ( void   )  const [virtual]

Find the id associated with topology object.

A bit of a hack because id is unknown to Topology_Object the get_id returns the same thing as id -- we just need someone to find it for us.

Reimplemented from TAO_Notify::Topology_Object.

Definition at line 531 of file EventChannelFactory.cpp.

{
  return id();
}

bool TAO_Notify_EventChannelFactory::handle_change ( void   ) 

Handle change notifications.

void TAO_Notify_EventChannelFactory::init ( PortableServer::POA_ptr  poa  ) 

Init the factory.

Definition at line 83 of file EventChannelFactory.cpp.

{
  this->poa_ = PortableServer::POA::_duplicate (poa);

  ACE_ASSERT (this->ec_container_.get() == 0);

  // Init ec_container_
  TAO_Notify_EventChannel_Container* ecc = 0;
  ACE_NEW_THROW_EX (ecc,
                    TAO_Notify_EventChannel_Container (),
                    CORBA::INTERNAL ());
  this->ec_container_.reset( ecc );

  this->ec_container().init ();

  TAO_Notify_POA_Helper* object_poa = 0;

  // Bootstrap initial Object POA
  ACE_NEW_THROW_EX (object_poa,
                    TAO_Notify_POA_Helper (),
                    CORBA::NO_MEMORY ());

  ACE_Auto_Ptr<TAO_Notify_POA_Helper> auto_object_poa (object_poa);

  ACE_CString poa_name = object_poa->get_unique_id ();
#if defined (CORBA_E_MICRO)
  object_poa->init (poa, poa_name.c_str ());
#else
  object_poa->init_persistent (poa, poa_name.c_str ());
#endif /* CORBA_E_MICRO */

  this->adopt_poa (auto_object_poa.release ());

  // Note topology factory is configured separately from the "builder" mediated
  // objects since it is independant of the "style" of Notification Service.
  this->topology_factory_ =
    ACE_Dynamic_Service <TAO_Notify::Topology_Factory>::instance ("Topology_Factory");

  this->load_topology ();

  this->load_event_persistence ();

  if (TAO_Notify_PROPERTIES::instance()->validate_client() == true)
  {
    TAO_Notify_validate_client_Task* validate_client_task = 0;
    ACE_NEW_THROW_EX (validate_client_task,
      TAO_Notify_validate_client_Task (TAO_Notify_PROPERTIES::instance()->validate_client_delay (),
                                 TAO_Notify_PROPERTIES::instance()->validate_client_interval (),
                                 this),
      CORBA::INTERNAL ());
    this->validate_client_task_.reset (validate_client_task);
  }
}

CORBA::Boolean TAO_Notify_EventChannelFactory::is_alive ( void   )  [private, virtual]

Definition at line 445 of file EventChannelFactory.cpp.

{
  return CORBA::Boolean (1);
}

bool TAO_Notify_EventChannelFactory::is_persistent ( void   )  const [virtual]

Should this object be saved?

This is a way for send_change() and save_persistent() to find out if this object has a persistent QoS connection property.

Returns:
true (default) if object should be saved.

Reimplemented from TAO_Notify::Topology_Object.

Definition at line 270 of file EventChannelFactory.cpp.

{
  return true;
}

TAO_Notify::Topology_Object * TAO_Notify_EventChannelFactory::load_child ( const ACE_CString type,
CORBA::Long  id,
const TAO_Notify::NVPList attrs 
) [virtual]

Create a child of the appropriate type and return it.

Use "type" as passed in to determine what kind of child (supporting the Topology_Object interface) to create and return. Inform it of its new ID.

Reimplemented from TAO_Notify::Topology_Object.

Definition at line 376 of file EventChannelFactory.cpp.

{
  // ignore anything but our valid children (ie channel)
  TAO_Notify::Topology_Object * result = this;
  if (type == "channel")
  {
    if (DEBUG_LEVEL) ACE_DEBUG ((LM_DEBUG,
      ACE_TEXT ("(%P|%t) EventChannelFactory reload channel %d\n")
      , static_cast<int> (id)
      ));

    TAO_Notify_Builder* bld = TAO_Notify_PROPERTIES::instance()->builder();
    TAO_Notify_EventChannel * ec = bld->build_event_channel(
        this ,
        id);

    ec->load_attrs (attrs);

    result = ec;
  }
  else if (type == TAO_Notify::REGISTRY_TYPE)
  {
    result = & this->reconnect_registry_;
  }
  return result;
}

void TAO_Notify_EventChannelFactory::load_event_persistence ( void   ) 

Definition at line 302 of file EventChannelFactory.cpp.

{
  TAO_Notify::Event_Persistence_Strategy * strategy =
    ACE_Dynamic_Service <TAO_Notify::Event_Persistence_Strategy>::instance ("Event_Persistence");
  if (strategy != 0)
  {
    if (this->topology_factory_ != 0)
    {
      TAO_Notify::Event_Persistence_Factory * factory = strategy->get_factory ();
      if (factory != 0)
      {
        for (
          TAO_Notify::Routing_Slip_Persistence_Manager * rspm = factory->first_reload_manager();
          rspm != 0;
          rspm = rspm->load_next ())
        {
          TAO_Notify::Routing_Slip_Ptr routing_slip = TAO_Notify::Routing_Slip::create (*this, rspm);
          if (!routing_slip.null ())
          {
            this->routing_slip_restart_set_.insert (routing_slip);
          }
          else
          {
            //@@todo: tell the rspm it's an orphan, but we can't during reload
            // we need collect these and come back later to remove them
            ACE_DEBUG ((LM_DEBUG,
              ACE_TEXT ("(%P|%t) Reload persistent event failed.\n")
              ));
          }
        }
      }
    }
    else
    {
      ACE_ERROR ((LM_ERROR,
        ACE_TEXT ("(%P|%t) Notify Service: Configuration error.  Event Persistence requires Topology Persistence.\n")
        ));
      throw CORBA::PERSIST_STORE();
    }
  }
}

void TAO_Notify_EventChannelFactory::load_topology ( void   ) 

Use the registered Topology_Factory to create a loader, and load the topology. If no Topology_Factory is registered then nothing will be loaded.

Definition at line 232 of file EventChannelFactory.cpp.

{
  this->loading_topology_ = true;
  if (this->topology_factory_ != 0)
  {
    // create_loader will open and load the persistence file for validation
    auto_ptr<TAO_Notify::Topology_Loader> tl(this->topology_factory_->create_loader());
    if (tl.get () != 0)
    {
      tl->load (this);
    }
  }
  else
  {
    if (TAO_debug_level > 0)
      ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Topology persistence disabled.\n")));
  }
  this->loading_topology_ = false;
}

void TAO_Notify_EventChannelFactory::reconnect ( void   )  [virtual]

Re-establish connections that we had before a shutdown.

After a topology restore, this method is called so we can reconnect to any external objects with whom we were interacting. We should call the reconnect() method on all of our children to give them the chance to do the same.

Reimplemented from TAO_Notify::Topology_Savable.

Definition at line 407 of file EventChannelFactory.cpp.

{
  // Reconnect all children first
  TAO_Notify::Reconnect_Worker<TAO_Notify_EventChannel> wrk;

  this->ec_container().collection()->for_each(&wrk);

  // Then send reconnection announcement to registered clients
  ACE_ASSERT (!CORBA::is_nil (this->channel_factory_.in ()));
  this->reconnect_registry_.send_reconnect (this->channel_factory_.in ());

  // reactivate events in-progress
  Routing_Slip_Set::CONST_ITERATOR iter (this->routing_slip_restart_set_);
  TAO_Notify::Routing_Slip_Ptr * routing_slip;
  for (iter.first(); iter.next(routing_slip); iter.advance())
  {
    (*routing_slip)->reconnect();
  }
  this->routing_slip_restart_set_.reset ();
}

NotifyExt::ReconnectionRegistry::ReconnectionID TAO_Notify_EventChannelFactory::register_callback ( NotifyExt::ReconnectionCallback_ptr  reconnection  )  [private, virtual]

Definition at line 429 of file EventChannelFactory.cpp.

{
  return this->reconnect_registry_.register_callback (
    reconnection);
}

void TAO_Notify_EventChannelFactory::release ( void   )  [private, virtual]

Release this object.

Definition at line 150 of file EventChannelFactory.cpp.

{
  delete this;
  //@@ inform factory
}

void TAO_Notify_EventChannelFactory::remove ( TAO_Notify_EventChannel channel  )  [virtual]

Remove channel from the <ec_container_>

Definition at line 157 of file EventChannelFactory.cpp.

{
  this->ec_container().remove (event_channel);
  this->self_change ();
}

void TAO_Notify_EventChannelFactory::save_persistent ( TAO_Notify::Topology_Saver saver  )  [virtual]

Save our state to a Topology_Saver.

Use the methods of a Topology_Saver to store all information we want persisted. This function is called by our parent, which gives us a saver to use. In turn, we must call this function on all of our children. The implementation should look like: bool change = this->self_changed_; this->self_changed_ = false; this->children_changed_ = false; if (is_persistent ()) { bool want_all_children = saver.begin_object( this->id(), type, attrs, change); for all children { if (want_all_children || child.is_changed()) { child.save_persistent(saver); } } for all deleted children { saver.delete_child(child_type, child_id); } saver.end_object(this->id(), type); )

Implements TAO_Notify::Topology_Savable.

Definition at line 276 of file EventChannelFactory.cpp.

{
  bool changed = this->self_changed_;
  this->self_changed_ = false;
  this->children_changed_ = false;

  TAO_Notify::NVPList attrs; // ECF has no attributes

  bool want_all_children =
    saver.begin_object(0, "channel_factory", attrs, changed);

  // for each deleted child
  //  delete_child  // if the child has persistence.

  TAO_Notify::Save_Persist_Worker<TAO_Notify_EventChannel> wrk(saver, want_all_children);

  this->ec_container().collection()->for_each(&wrk);

  if (want_all_children || this->reconnect_registry_.is_changed ())
  {
    this->reconnect_registry_.save_persistent(saver);
  }
  saver.end_object(0, "channel_factory");
}

void TAO_Notify_EventChannelFactory::save_topology ( void   )  [virtual]

Definition at line 451 of file EventChannelFactory.cpp.

{
  this->self_change ();
}

void TAO_Notify_EventChannelFactory::set_topology_factory ( TAO_Notify::Topology_Factory sf  ) 

Use the passed in saver factory to generate topology saver objects. Does not take ownership.

Definition at line 220 of file EventChannelFactory.cpp.

{
  ACE_DEBUG ((LM_DEBUG,
    ACE_TEXT ("(%P,%t) Debug Topology_Factory installed in EventChannelFactory.\n")
    ));
  // If the above meessage appears when you don't expect it
  // use svc.conf to install the topology factory rather
  // than calling this method.
  this->topology_factory_ = f;
}

int TAO_Notify_EventChannelFactory::shutdown ( void   )  [private, virtual]

shutdown

Definition at line 164 of file EventChannelFactory.cpp.

{
  this->stop_validator();

  if (TAO_Notify_Object::shutdown () == 1)
    return 1;

  this->ec_container().shutdown ();

  return 0;
}

void TAO_Notify_EventChannelFactory::stop_validator ( void   ) 

at shutdown time, this causes the validator thread to exit.

Definition at line 261 of file EventChannelFactory.cpp.

{
  if (this->validate_client_task_.get () != 0)
    {
      this->validate_client_task_->shutdown ();
    }
}

void TAO_Notify_EventChannelFactory::unregister_callback ( NotifyExt::ReconnectionRegistry::ReconnectionID  id  )  [private, virtual]

Definition at line 437 of file EventChannelFactory.cpp.

void TAO_Notify_EventChannelFactory::validate (  )  [virtual]

Definition at line 253 of file EventChannelFactory.cpp.


Friends And Related Function Documentation

friend class TAO_Notify_Builder [friend]

Definition at line 56 of file EventChannelFactory.h.


Member Data Documentation

CosNotifyChannelAdmin::EventChannelFactory_var TAO_Notify_EventChannelFactory::channel_factory_ [private]

Definition at line 168 of file EventChannelFactory.h.

Container for Event Channels.

Definition at line 164 of file EventChannelFactory.h.

Definition at line 174 of file EventChannelFactory.h.

Definition at line 183 of file EventChannelFactory.h.

Definition at line 173 of file EventChannelFactory.h.

Definition at line 176 of file EventChannelFactory.h.

Definition at line 172 of file EventChannelFactory.h.

Definition at line 166 of file EventChannelFactory.h.

Change-in-progress detector to avoid duplicates.

Definition at line 171 of file EventChannelFactory.h.

Definition at line 181 of file EventChannelFactory.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines