version 1.1, 2001/01/24 14:18:48
|
version 1.2, 2001/02/23 20:27:46
|
|
|
/* | /* |
$Log$ | $Log$ |
|
Revision 1.2 2001/02/23 20:27:46 karl |
|
correct documentation |
|
|
Revision 1.1 2001/01/24 14:18:48 karl | Revision 1.1 2001/01/24 14:18:48 karl |
import Dev Doc Files | import Dev Doc Files |
| |
$Author$ | $Author$ |
*/ | */ |
/** @name Examples of C++ Client calls |
/** @name Pegasus Code Examples |
|
|
<PRE><CODE> |
|
Example of Class Declaration |
|
|
|
#include <Pegasus/ClassDecl.h> |
|
#include <Pegasus/Name.h> |
|
|
|
using namespace Pegasus; |
|
|
|
void test01() |
|
{ |
|
ClassDecl class1("MyClass", "YourClass"); |
|
|
|
class1 |
|
.addQualifier(Qualifier("association", true)) |
|
.addQualifier(Qualifier("q1", Uint32(55))) |
|
.addQualifier(Qualifier("q2", "Hello")) |
|
.addProperty(Property("message", "Hello")) |
|
.addProperty(Property("count", Uint32(77))) |
|
.addProperty( |
|
Property("ref1", Reference("MyClass.key1=\"fred\""), "MyClass")) |
|
.addMethod(Method("isActive", Type::BOOLEAN) |
|
.addParameter(Parameter("hostname", Type::STRING)) |
|
.addParameter(Parameter("port", Type::UINT32))); |
|
|
|
// class1.print(); |
|
|
|
OutBuffer out; |
|
out << class1; |
|
|
|
InBuffer in(out.getData()); |
|
ClassDecl tmp; |
|
in >> tmp; |
|
|
|
assert(class1.identical(tmp)); |
|
} |
|
|
|
int main() |
|
{ |
|
try |
|
{ |
|
test01(); |
|
} |
|
catch (Exception& e) |
|
{ |
|
cout << "Exception: " << e.getMessage() << endl; |
|
} |
|
| |
cout << "+++++ passed all tests" << endl; |
The following sections provide some examples of the use of the Pegasus APIs for clients, providers and services. |
| |
return 0; |
There are also a number of good examples of Pegasus API and Class usage |
} |
in the tests defined for the major Pegasus components. See the tests |
|
directories for a list of the tests currently implemented. |
| |
</CODE/> |
|
</PRE> |
|
*/ | */ |