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 {
26 public:
27 // ctor
28 HomeFinder_Impl(CORBA::ORB_var theOrb) : orb(theOrb) {}
29
30 // HomeFinder's interface
31 CCMHome_ptr find_home_by_component_type( const char* comp_repid );
32 CCMHome_ptr find_home_by_home_type( const char* home_repid );
33 CCMHome_ptr find_home_by_name( const char* home_name );
34 // additional interface requested by Mr. von Loewis
35 CORBA::Long _cxx_register( const char* comp_repid, const char* home_repid, CCMHome_ptr the_home );
36 void unregister( CORBA::Long cookie );
37
38 private:
39 // the ORB's reference
40 CORBA::ORB_var orb;
41 // a very basic unique ID generator
42 static CORBA::Long uniqueId;
43
44 // a single entry of the directory
45 struct Entry
46 {
47 string compRepId;
48 string homeRepId;
49 string homeName;
50 CORBA::Long uniqueId;
51 };
52
53 // a collection holding the directory
54 typedef list<Entry> directoryCollection;
55 // an iterator (for the directory)
56 typedef directoryCollection::iterator directoryIterator;
57 // the directory itself
58 directoryCollection directory;
59 };
60
61
62 #endif // __HOMEFINDERIMPL_H__
63