Back to index

nordugrid-arc-nox  1.1.0~rc6
TestMCC.cpp
Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #include <config.h>
00003 #endif
00004 
00005 #include <iostream>
00006 #include "TestMCC.h"
00007 #include <arc/message/MCCLoader.h>
00008 
00009 namespace Test {
00010 
00011 TestMCC::TestMCC(Arc::Config *cfg) : Arc::MCC(cfg)
00012 {
00013     std::string s;
00014     std::cout << "Init: TestMCC" << std::endl;
00015     cfg->GetXML(s);
00016     std::cout << "Configuration:\n" << s << std::endl;
00017     a = 1;
00018 }
00019 
00020 TestMCC::~TestMCC(void) 
00021 {
00022     std::cout << "Destroy: TestMCC " << std::endl;
00023 }
00024 
00025 Arc::Message TestMCC::process(Arc::Message)
00026 {
00027     std::cout << "process: TestMCC" << std::endl;
00028     std::cout << "private variable: " << a << std::endl;
00029     std::cout << "Defined \"next\"s: " << std::endl;
00030     for(std::map<std::string,MCCInterface*>::iterator i = next_.begin(); i != next_.end(); ++i) {
00031         std::cout << "Name: " << i->first << " - " << ((i->second)?"defined":"undefined") << std::endl;
00032     }
00033     Arc::Message msg;
00034     return msg;
00035 }
00036 
00037 Arc::Plugin *get_mcc_instance(Arc::PluginArgument* arg) 
00038 {
00039     Arc::MCCPluginArgument* mccarg =
00040             arg?dynamic_cast<Arc::MCCPluginArgument*>(arg):NULL;   
00041     if(!mccarg) return NULL;
00042     return new TestMCC((Arc::Config*)(*mccarg));
00043 }
00044 
00045 } // namespace Test
00046 
00047 /* MCC plugin descriptor */
00048 Arc::PluginDescriptor PLUGINS_TABLE_NAME[] = {
00049     {
00050         "testmcc",                /* name */
00051         "HED:MCC",                /* kind */
00052         0,                        /* version */
00053         &(Test::get_mcc_instance) /* get_instance function */
00054     },
00055     { NULL, NULL, 0, NULL }
00056 };