• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

sst/elements/event_test/event_test.h

00001 // Copyright 2009-2010 Sandia Corporation. Under the terms
00002 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
00003 // Government retains certain rights in this software.
00004 // 
00005 // Copyright (c) 2009-2010, Sandia Corporation
00006 // All rights reserved.
00007 // 
00008 // This file is part of the SST software package. For license
00009 // information, see the LICENSE file in the top level directory of the
00010 // distribution.
00011 
00012 
00013 #ifndef _EVENT_TEST_H
00014 #define _EVENT_TEST_H
00015 
00016 #include <sst/core/event.h>
00017 #include <sst/core/component.h>
00018 #include <sst/core/link.h>
00019 #include <sst/core/timeConverter.h>
00020 //#include <sst/core/eventFunctor.h>
00021 
00022 class event_test : public SST::Component {
00023 public:
00024     event_test(SST::ComponentId_t id, SST::Component::Params_t& params);
00025 
00026     int Setup();
00027     int Finish();
00028     
00029 private:
00030     event_test();  // for serialization only
00031     event_test(const event_test&); // do not implement
00032     void operator=(const event_test&); // do not implement
00033 
00034     void handleEvent( SST::Event *ev );
00035 
00036     int my_id;
00037     int count_to;
00038     int latency;
00039     bool done;
00040     SST::Link* link;
00041 
00042     friend class boost::serialization::access;
00043     template<class Archive>
00044     void save(Archive & ar, const unsigned int version) const
00045     {
00046         ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Component);
00047         ar & BOOST_SERIALIZATION_NVP(my_id);
00048         ar & BOOST_SERIALIZATION_NVP(count_to);
00049         ar & BOOST_SERIALIZATION_NVP(latency);
00050         ar & BOOST_SERIALIZATION_NVP(done);
00051         ar & BOOST_SERIALIZATION_NVP(link);
00052     }
00053 
00054     template<class Archive>
00055     void load(Archive & ar, const unsigned int version)
00056     {
00057         ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Component);
00058         ar & BOOST_SERIALIZATION_NVP(my_id);
00059         ar & BOOST_SERIALIZATION_NVP(count_to);
00060         ar & BOOST_SERIALIZATION_NVP(latency);
00061         ar & BOOST_SERIALIZATION_NVP(done);
00062         ar & BOOST_SERIALIZATION_NVP(link);
00063 
00064 //         SST::EventHandler_t* linkHandler = new SST::EventHandler<event_test,bool,SST::Event*>
00065 //             (this,&event_test::handleEvent);
00066 //         link->setFunctor(linkHandler);
00067         link->setFunctor(new SST::Event::Handler<event_test>(this,&event_test::handleEvent));
00068     }
00069 
00070     BOOST_SERIALIZATION_SPLIT_MEMBER()
00071 };
00072 
00073 #endif

Generated on Fri Oct 22 2010 11:02:21 for SST by  doxygen 1.7.1