1 // ////////////////////////////////////////////////////////
2 // Lecture on the CORBA Component Model, summer term 2003
3 // Assignment 6, Stephan Brumme, 702544
4 //
5 // CORBA CCM HomeFinder (Implementation)
6 //
7
8 #ifndef __HOMEFINDERIMPL_H__
9 #define __HOMEFINDERIMPL_H__
10
11 // generated by the IDL compiler
12 #pragma warning (disable: 4267)
13 #include "ccm.h"
14
15 // use some stuff from STL
16 #include <list>
17 #include <string>
18 using namespace std;
19
20
21 // just for convenience
22 using namespace Components;
23
24 class HomeFinder_Impl : public virtual POA_HPI::HomeFinder
{
25 public:
26 // ctor
27 HomeFinder_Impl(CORBA::ORB_var theOrb) : orb(theOrb) {}
28
29 // HomeFinder's interface
30 CCMHome_ptr find_home_by_component_type( const char* comp_repid );
31 CCMHome_ptr find_home_by_home_type( const char* home_repid );
32 CCMHome_ptr find_home_by_name( const char* home_name );
33 // additional interface requested by Mr. von Loewis
34 CORBA::Long _cxx_register( const char* comp_repid, const char* home_repid, CCMHome_ptr the_home );
35 void unregister( CORBA::Long cookie );
36
37 private:
38 // the ORB's reference
39 CORBA::ORB_var orb;
40 // a very basic unique ID generator
41 static CORBA::Long uniqueId;
42
43 // a single entry of the directory
44 struct Entry
{
45 string compRepId;
46 string homeRepId;
47 string homeName;
48 CORBA::Long uniqueId;
49 };
50
51 // a collection holding the directory
52 typedef list<Entry> directoryCollection;
53 // an iterator (for the directory)
54 typedef directoryCollection::iterator directoryIterator;
55 // the directory itself
56 directoryCollection directory;
57 };
58
59
60 #endif // __HOMEFINDERIMPL_H__
61