1 karl 1.1 /*
2 $Log$
3 $Author$
4 */
5 /** @name Examples of C++ Client calls
6
7 <PRE><CODE>
8 Example of Class Declaration
9
10 #include <Pegasus/ClassDecl.h>
11 #include <Pegasus/Name.h>
12
13 using namespace Pegasus;
14
15 void test01()
16 {
17 ClassDecl class1("MyClass", "YourClass");
18
19 class1
20 .addQualifier(Qualifier("association", true))
21 .addQualifier(Qualifier("q1", Uint32(55)))
22 karl 1.1 .addQualifier(Qualifier("q2", "Hello"))
23 .addProperty(Property("message", "Hello"))
24 .addProperty(Property("count", Uint32(77)))
25 .addProperty(
26 Property("ref1", Reference("MyClass.key1=\"fred\""), "MyClass"))
27 .addMethod(Method("isActive", Type::BOOLEAN)
28 .addParameter(Parameter("hostname", Type::STRING))
29 .addParameter(Parameter("port", Type::UINT32)));
30
31 // class1.print();
32
33 OutBuffer out;
34 out << class1;
35
36 InBuffer in(out.getData());
37 ClassDecl tmp;
38 in >> tmp;
39
40 assert(class1.identical(tmp));
41 }
42
43 karl 1.1 int main()
44 {
45 try
46 {
47 test01();
48 }
49 catch (Exception& e)
50 {
51 cout << "Exception: " << e.getMessage() << endl;
52 }
53
54 cout << "+++++ passed all tests" << endl;
55
56 return 0;
57 }
58
59 </CODE/>
60 </PRE>
61 */
|