/******************************************************************************* * ALMA - Atacama Large Millimiter Array * (c) National Research Council of Canada, 2005 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * "@(#) $Id: testArchiveSupplier.cpp,v 1.4 2012/10/09 14:32:23 bjeram Exp $" * * who when what * -------- -------- ---------------------------------------------- * dfugate 2005-09-08 created */ /************************************************************************ * NAME * * * SYNOPSIS * * * DESCRIPTION * * FILES * * ENVIRONMENT * * COMMANDS * * RETURN VALUES * * CAUTIONS * * EXAMPLES * * SEE ALSO * * BUGS * *------------------------------------------------------------------------ */ #include #include #include #include "archiveeventsArchiveSupplier.h" #include #include using namespace maci; static char *rcsId="@(#) $Id: testArchiveSupplier.cpp,v 1.4 2012/10/09 14:32:23 bjeram Exp $"; static void *use_rcsId = ((void)&use_rcsId,(void *) &rcsId); template void sendEvent(const T value) { ACS_SHORT_LOG((LM_INFO, "Sending an event.")); ArchiveSupplierSingleton::Instance().sendEvent(0, 0ULL, "no component", "no property", (T)value); } int main(int argc, char *argv[]) { SimpleClient client; if (client.init(argc,argv) == 0) { ACE_DEBUG((LM_DEBUG,"Cannot init client")); return -1; } else { //Must log into manager before we can really do anything client.login(); } //get the naming service to use with archive supplier's init method CORBA::Object_var nc_obj = client.manager()->get_service(client.handle(), "NameService", true); CosNaming::NamingContext_var nc = CosNaming::NamingContext::_narrow(nc_obj.in()); //initialize the singleton ArchiveSupplierSingleton::Instance().init(nc.in()); //send events of supported types only for now //double sendEvent(3.14); //flaot sendEvent(3.1); //long sendEvent(1); //unsigned long sendEvent(2); //pattern sendEvent(3); //long long sendEvent(4); //unsigned long long sendEvent(5); //string sendEvent((const char*)"a string"); //boolean sendEvent(true); //double seqence { ACS::doubleSeq mySeq(1); mySeq.length(1); mySeq[0] = (CORBA::Double)3.14; sendEvent(mySeq); } //float seqence { ACS::floatSeq mySeq(1); mySeq.length(1); mySeq[0] = (CORBA::Float)3.1; sendEvent(mySeq); } //long seqence { ACS::longSeq mySeq(1); mySeq.length(1); mySeq[0] = (CORBA::Long)1; sendEvent(mySeq); } //uLong seqence { ACS::uLongSeq mySeq(1); mySeq.length(1); mySeq[0] = (ACS::uLong)1; sendEvent(mySeq); } //string seqence { ACS::stringSeq mySeq(1); mySeq.length(1); mySeq[0] = CORBA::string_dup("a string"); sendEvent(mySeq); } //boolean seqence { ACS::booleanSeq mySeq(1); mySeq.length(1); mySeq[0] = true; sendEvent(mySeq); } client.logout(); return 0; }