#include <OB/CORBA.h>
#include <cstdlib>
#include "HxIo.h"
#include "HxString.h"
#include "HxDefaultCorbaMediator.h"
#include "HxCorbaGlobalOps.h"
#include "HxCorbaImageRep.h"
Functions | |
| int | clientDemoImageOps (int argc, char *argv[]) |
| A simple demo for calling some global image processing function via Corba. More... | |
| int | main (int argc, char *argv[]) |
| The "standard" main of a C++ client (console) application. More... | |
Variables | |
| const HxString | inputDir = "/home/horus/images/" |
| const HxString | outputDir = HxString(getenv("HOME")) + "/output/" |
|
||||||||||||
|
A simple demo for calling some global image processing function via Corba.
00032 {
00033 HxCorbaMediator* med = HxCorbaMediator::instance();
00034
00035 CORBA::Object_var obj = med->getInitialObject("GlobalOps");
00036 HxCorba::GlobalOps_var ops = HxCorba::GlobalOps::_narrow(obj);
00037
00038 HxString inputFileName = inputDir + "bnoise.tif";
00039 STD_COUT << "Reading [" << inputFileName << "]" << STD_ENDL;
00040 HxCorba::ImageRep_var im = ops->HxMakeFromFile(inputFileName.c_str());
00041
00042 std::cout << "Applying percentile filter" << std::endl;
00043 HxCorba::ImageRep_var result = ops->HxPercentile(im, 3, 0.5);
00044
00045 HxString outputFileName = outputDir + "blittlenoise.tif";
00046 STD_COUT << "Writing result to [" << outputFileName << "]" << STD_ENDL;
00047 ops->HxWriteFile(result, outputFileName.c_str());
00048
00049 std::cout << "Done" << std::endl;
00050 return EXIT_SUCCESS;
00051 }
|
|
||||||||||||
|
The "standard" main of a C++ client (console) application. main sets up the Corba mediator and catches all Corba exceptions. The actual program is implemented in clientDemoImageOps.
00059 {
00060 int status = EXIT_SUCCESS;
00061
00062 try {
00063 HxDefaultCorbaMediator mediator(argc, argv);
00064 status = clientDemoImageOps(argc, argv);
00065 }
00066 catch(const CORBA::Exception& ex) {
00067 std::cerr << ex << std::endl;
00068 status = EXIT_FAILURE;
00069 }
00070
00071 return status;
00072 }
|
|
|
|
|
|
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001