[complement-svn] SF.net SVN: complement: [1684] trunk/complement/explore
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2007-08-17 06:47:46
|
Revision: 1684 http://complement.svn.sourceforge.net/complement/?rev=1684&view=rev Author: complement Date: 2007-08-16 23:47:44 -0700 (Thu, 16 Aug 2007) Log Message: ----------- namespace vt -> janus; VTDispatcher -> Janus; VTmess -> VSmess Modified Paths: -------------- trunk/complement/explore/include/janus/vtime.h trunk/complement/explore/lib/janus/ut/VTmess_core.cc trunk/complement/explore/lib/janus/ut/vt_dispatch.cc trunk/complement/explore/lib/janus/ut/vt_handler.cc trunk/complement/explore/lib/janus/ut/vt_object.cc trunk/complement/explore/lib/janus/ut/vt_operations.cc trunk/complement/explore/lib/janus/ut/vt_remote.cc trunk/complement/explore/lib/janus/vtime.cc Modified: trunk/complement/explore/include/janus/vtime.h =================================================================== --- trunk/complement/explore/include/janus/vtime.h 2007-08-16 19:20:06 UTC (rev 1683) +++ trunk/complement/explore/include/janus/vtime.h 2007-08-17 06:47:44 UTC (rev 1684) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/08/11 01:05:47 ptr> +// -*- C++ -*- Time-stamp: <07/08/17 10:38:35 ptr> #ifndef __vtime_h #define __vtime_h @@ -19,25 +19,25 @@ #include <mt/time.h> -namespace vt { +namespace janus { // typedef stem::addr_type oid_type; typedef stem::gaddr_type oid_type; -} // namespace vt +} // namespace janus namespace std { template <> -struct hash<vt::oid_type> +struct hash<janus::oid_type> { - size_t operator()(const vt::oid_type& __x) const + size_t operator()(const janus::oid_type& __x) const { return __x.addr; } }; } // namespace std -namespace vt { +namespace janus { typedef uint32_t vtime_unit_type; typedef stem::addr_type group_type; // required, used in VTSend @@ -188,7 +188,7 @@ gvtime gvt; }; -struct VTmess : +struct VSmess : public VSsync { void pack( std::ostream& s ) const; @@ -196,11 +196,11 @@ void unpack( std::istream& s ); void net_unpack( std::istream& s ); - VTmess() : + VSmess() : code(0), src() { } - VTmess( const VTmess& _gvt ) : + VSmess( const VSmess& _gvt ) : VSsync( _gvt ), code( _gvt.code ), src( _gvt.src ) @@ -229,9 +229,9 @@ stem::addr_type stem_addr() const { return addr; } - bool deliver( const VTmess& ev ); - bool deliver_delayed( const VTmess& ev ); - std::ostream& trace_deliver( const VTmess& m, std::ostream& o ); + bool deliver( const VSmess& ev ); + bool deliver_delayed( const VSmess& ev ); + std::ostream& trace_deliver( const VSmess& m, std::ostream& o ); void next( const oid_type& from, group_type grp ) { ++vt.gvt[grp][from]; /* increment my VT counter */ } void delta( gvtime& vtstamp, const oid_type& from, const oid_type& to, group_type grp ); @@ -260,19 +260,19 @@ public: // delay pool should be here - typedef std::pair<xmt::timespec,stem::Event_base<VTmess>*> delay_item_t; + typedef std::pair<xmt::timespec,stem::Event_base<VSmess>*> delay_item_t; typedef std::list<delay_item_t> dpool_t; dpool_t dpool; private: - bool order_correct( const VTmess& ); - bool order_correct_delayed( const VTmess& ); + bool order_correct( const VSmess& ); + bool order_correct_delayed( const VSmess& ); }; } // namespace detail -class VTDispatcher : +class Janus : public stem::EventHandler { public: @@ -285,32 +285,32 @@ tracegroup = 0x10 }; - VTDispatcher() : + Janus() : _trflags( notrace ), _trs( 0 ) { } - VTDispatcher( const char *info ) : + Janus( const char *info ) : stem::EventHandler( info ), _trflags( notrace ), _trs( 0 ) { } - VTDispatcher( stem::addr_type id ) : + Janus( stem::addr_type id ) : stem::EventHandler( id ), _trflags( notrace ), _trs( 0 ) { } - VTDispatcher( stem::addr_type id, const char *info ) : + Janus( stem::addr_type id, const char *info ) : stem::EventHandler( id, info ), _trflags( notrace ), _trs( 0 ) { } - void VTDispatch( const stem::Event_base<VTmess>& ); + void JaDispatch( const stem::Event_base<VSmess>& ); - void VTSend( const stem::Event& e, group_type ); + void JaSend( const stem::Event& e, group_type ); void Subscribe( stem::addr_type, oid_type, group_type ); void Unsubscribe( oid_type, group_type ); void Unsubscribe( oid_type ); @@ -328,7 +328,7 @@ typedef std::hash_map<oid_type, detail::vtime_obj_rec> vt_map_type; typedef std::hash_multimap<group_type, oid_type> gid_map_type; - void check_and_send( detail::vtime_obj_rec&, const stem::Event_base<VTmess>& ); + void check_and_send( detail::vtime_obj_rec&, const stem::Event_base<VSmess>& ); void check_and_send_delayed( detail::vtime_obj_rec& ); vt_map_type vtmap; @@ -338,7 +338,7 @@ unsigned _trflags; std::ostream *_trs; - DECLARE_RESPONSE_TABLE( VTDispatcher, stem::EventHandler ); + DECLARE_RESPONSE_TABLE( Janus, stem::EventHandler ); }; class VTHandler : @@ -363,7 +363,7 @@ explicit VTHandler( stem::addr_type id, const char *info = 0 ); virtual ~VTHandler(); - void VTSend( const stem::Event& e ); + void JaSend( const stem::Event& e ); void JoinGroup( group_type grp ) { _vtdsp->Subscribe( self_id(), oid_type( self_id() ), grp ); } virtual void VSNewMember( const stem::Event_base<VSsync_rq>& e ); @@ -371,11 +371,11 @@ virtual void VSsync_time( const stem::Event_base<VSsync>& ); - template <class D> - void VTSend( const stem::Event_base<D>& e ) - { VTHandler::VTSend( stem::Event_convert<D>()( e ) ); } + // template <class D> + // void JaSend( const stem::Event_base<D>& e ) + // { VTHandler::JaSend( stem::Event_convert<D>()( e ) ); } - static VTDispatcher *vtdispatcher() + static Janus *vtdispatcher() { return _vtdsp; } protected: @@ -385,7 +385,7 @@ { _vtdsp->get_gvtime( g, self_id(), gvt ); } private: - static class VTDispatcher *_vtdsp; + static class Janus *_vtdsp; DECLARE_RESPONSE_TABLE( VTHandler, stem::EventHandler ); }; @@ -395,18 +395,18 @@ #define VS_OUT_MEMBER 0x302 #define VS_SYNC_TIME 0x303 -} // namespace vt +} // namespace janus namespace std { -ostream& operator <<( ostream&, const vt::vtime_type::value_type& ); -ostream& operator <<( ostream&, const vt::vtime_type& ); -ostream& operator <<( ostream&, const vt::vtime& ); -ostream& operator <<( ostream&, const vt::gvtime_type::value_type& ); -ostream& operator <<( ostream&, const vt::gvtime_type& ); -ostream& operator <<( ostream&, const vt::gvtime& ); -ostream& operator <<( ostream& o, const vt::VSsync& ); -ostream& operator <<( ostream& o, const vt::VTmess& ); +ostream& operator <<( ostream&, const janus::vtime_type::value_type& ); +ostream& operator <<( ostream&, const janus::vtime_type& ); +ostream& operator <<( ostream&, const janus::vtime& ); +ostream& operator <<( ostream&, const janus::gvtime_type::value_type& ); +ostream& operator <<( ostream&, const janus::gvtime_type& ); +ostream& operator <<( ostream&, const janus::gvtime& ); +ostream& operator <<( ostream& o, const janus::VSsync& ); +ostream& operator <<( ostream& o, const janus::VSmess& ); } // namespace std Modified: trunk/complement/explore/lib/janus/ut/VTmess_core.cc =================================================================== --- trunk/complement/explore/lib/janus/ut/VTmess_core.cc 2007-08-16 19:20:06 UTC (rev 1683) +++ trunk/complement/explore/lib/janus/ut/VTmess_core.cc 2007-08-17 06:47:44 UTC (rev 1684) @@ -1,11 +1,11 @@ -// -*- C++ -*- Time-stamp: <07/07/25 22:06:40 ptr> +// -*- C++ -*- Time-stamp: <07/08/17 10:20:54 ptr> #include "vt_operations.h" #include <iostream> #include <janus/vtime.h> -using namespace vt; +using namespace janus; using namespace std; class VTM_handler : @@ -17,8 +17,8 @@ VTM_handler( stem::addr_type id, const char *info ); ~VTM_handler(); - void handlerE( const stem::Event_base<VTmess>& ); - void handlerV( const VTmess& ); + void handlerE( const stem::Event_base<VSmess>& ); + void handlerV( const VSmess& ); void wait(); @@ -59,7 +59,7 @@ // cnd.wait(); } -void VTM_handler::handlerE( const stem::Event_base<VTmess>& ev ) +void VTM_handler::handlerE( const stem::Event_base<VSmess>& ev ) { code = ev.value().code; src = ev.value().src; @@ -71,7 +71,7 @@ cnd.set( true ); } -void VTM_handler::handlerV( const VTmess& m ) +void VTM_handler::handlerV( const VSmess& m ) { code = m.code; src = m.src; @@ -91,8 +91,8 @@ } DEFINE_RESPONSE_TABLE( VTM_handler ) - EV_Event_base_T_( ST_NULL, VT_MESS, handlerE, VTmess ) - EV_T_( 1, VT_MESS, handlerV, VTmess ) + EV_Event_base_T_( ST_NULL, VT_MESS, handlerE, VSmess ) + EV_T_( 1, VT_MESS, handlerV, VSmess ) END_RESPONSE_TABLE int EXAM_IMPL(vtime_operations::VTMess_core) @@ -103,7 +103,7 @@ VTM_handler h; - stem::Event_base<VTmess> ev( VT_MESS ); + stem::Event_base<VSmess> ev( VT_MESS ); ev.dest( h.self_id() ); ev.value().code = 2; Modified: trunk/complement/explore/lib/janus/ut/vt_dispatch.cc =================================================================== --- trunk/complement/explore/lib/janus/ut/vt_dispatch.cc 2007-08-16 19:20:06 UTC (rev 1683) +++ trunk/complement/explore/lib/janus/ut/vt_dispatch.cc 2007-08-17 06:47:44 UTC (rev 1684) @@ -1,13 +1,11 @@ -// -*- C++ -*- Time-stamp: <07/07/26 09:53:24 ptr> +// -*- C++ -*- Time-stamp: <07/08/17 10:39:45 ptr> #include "vt_operations.h" -// #include <boost/lexical_cast.hpp> - #include <iostream> #include <janus/vtime.h> -using namespace vt; +using namespace janus; using namespace std; class Dummy : @@ -75,7 +73,7 @@ int EXAM_IMPL(vtime_operations::VTDispatch1) { - vt::VTDispatcher dsp; + janus::Janus dsp; Dummy dummy1; Dummy dummy2; const oid_type t1(1); @@ -89,7 +87,7 @@ ev.value() = "hello"; - dsp.VTSend( ev, 0 ); + dsp.JaSend( ev, 0 ); dummy2.wait(); @@ -101,7 +99,7 @@ int EXAM_IMPL(vtime_operations::VTDispatch2) { - vt::VTDispatcher dsp; + janus::Janus dsp; Dummy dummy1; Dummy dummy2; Dummy dummy3; @@ -118,7 +116,7 @@ ev.value() = "hello"; - dsp.VTSend( ev, 0 ); + dsp.JaSend( ev, 0 ); dummy2.wait(); dummy3.wait(); Modified: trunk/complement/explore/lib/janus/ut/vt_handler.cc =================================================================== --- trunk/complement/explore/lib/janus/ut/vt_handler.cc 2007-08-16 19:20:06 UTC (rev 1683) +++ trunk/complement/explore/lib/janus/ut/vt_handler.cc 2007-08-17 06:47:44 UTC (rev 1684) @@ -1,19 +1,17 @@ -// -*- C++ -*- Time-stamp: <07/08/11 23:21:59 ptr> +// -*- C++ -*- Time-stamp: <07/08/17 10:41:22 ptr> #include "vt_operations.h" -// #include <boost/lexical_cast.hpp> - #include <iostream> #include <janus/vtime.h> #include <stem/EvManager.h> -using namespace vt; +using namespace janus; using namespace std; class VTDummy : - public vt::VTHandler + public janus::VTHandler { public: VTDummy(); @@ -42,7 +40,7 @@ xmt::condition cnd; xmt::condition gr; - DECLARE_RESPONSE_TABLE( VTDummy, vt::VTHandler ); + DECLARE_RESPONSE_TABLE( VTDummy, janus::VTHandler ); }; #define VS_DUMMY_MESS 0x1203 @@ -138,7 +136,7 @@ ev.dest( 0 ); // group ev.value() = "hello"; - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); dummy2.wait(); @@ -158,7 +156,7 @@ ev.dest( 0 ); // group ev.value() = "hello"; - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); dummy2.wait(); dummy3.wait(); @@ -172,7 +170,7 @@ ev.dest( 100 ); // not this group member try { - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); EXAM_ERROR( "exception expected" ); } catch ( std::domain_error& ) { @@ -190,7 +188,7 @@ ev.dest( 0 ); // group ev.value() = "hello"; - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); dummy2.wait(); EXAM_CHECK( dummy2.msg == "hello" ); @@ -199,7 +197,7 @@ VTDummy dummy3; ev.value() = "hi"; - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); dummy2.wait(); // dummy3.wait(); @@ -211,7 +209,7 @@ } ev.value() = "yet more"; - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); dummy2.wait(); EXAM_CHECK( dummy2.msg == "yet more" ); @@ -240,7 +238,7 @@ dummy3.wait_greeting(); ev.value() = "hi"; - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); dummy3.wait(); @@ -260,7 +258,7 @@ ev.dest( 0 ); // group ev.value() = "hello"; - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); dummy2.wait(); EXAM_CHECK( dummy2.msg == "hello" ); @@ -280,7 +278,7 @@ ev.value() = "hi"; ev.dest( 0 ); // group - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); dummy2.wait(); dummy3.wait(); @@ -306,7 +304,7 @@ ev.value() = "hello"; ev.dest( 0 ); // group - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); dummy2.wait(); EXAM_CHECK( dummy2.msg == "hello" ); @@ -320,7 +318,7 @@ ev.value() = "hi"; ev.dest( 0 ); // group - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); dummy3.wait(); @@ -337,7 +335,7 @@ ev.value() = "more"; ev.dest( 0 ); // group - dummy1.VTSend( ev ); + dummy1.JaSend( ev ); dummy2.wait(); dummy3.wait(); @@ -346,7 +344,7 @@ EXAM_CHECK( dummy3.msg == "more" ); EXAM_CHECK( dummy1.msg == "" ); - dummy2.VTSend( ev ); + dummy2.JaSend( ev ); dummy1.wait(); } Modified: trunk/complement/explore/lib/janus/ut/vt_object.cc =================================================================== --- trunk/complement/explore/lib/janus/ut/vt_object.cc 2007-08-16 19:20:06 UTC (rev 1683) +++ trunk/complement/explore/lib/janus/ut/vt_object.cc 2007-08-17 06:47:44 UTC (rev 1684) @@ -1,13 +1,11 @@ -// -*- C++ -*- Time-stamp: <07/07/25 22:09:32 ptr> +// -*- C++ -*- Time-stamp: <07/08/17 10:21:34 ptr> #include "vt_operations.h" -// #include <boost/lexical_cast.hpp> - #include <iostream> #include <janus/vtime.h> -using namespace vt; +using namespace janus; using namespace std; int EXAM_IMPL(vtime_operations::vt_object) @@ -29,8 +27,8 @@ // gvtime gvt; // gvt[gr0][obj1] = 1; - VTmess mess; - VTmess mess_bad; + VSmess mess; + VSmess mess_bad; mess_bad.code = mess.code = 1; mess_bad.src = mess.src = obj1; @@ -90,7 +88,7 @@ // ---- - VTmess mess2; + VSmess mess2; mess2.code = 1; mess2.src = obj2; @@ -158,7 +156,7 @@ // cerr << ob.vt[gr0] << endl; // cerr << "===========\n"; - VTmess mess3; + VSmess mess3; mess3.code = 1; mess3.src = obj2; Modified: trunk/complement/explore/lib/janus/ut/vt_operations.cc =================================================================== --- trunk/complement/explore/lib/janus/ut/vt_operations.cc 2007-08-16 19:20:06 UTC (rev 1683) +++ trunk/complement/explore/lib/janus/ut/vt_operations.cc 2007-08-17 06:47:44 UTC (rev 1684) @@ -1,13 +1,11 @@ -// -*- C++ -*- Time-stamp: <07/07/27 10:42:55 ptr> +// -*- C++ -*- Time-stamp: <07/08/17 10:06:23 ptr> #include "vt_operations.h" -// #include <boost/lexical_cast.hpp> - #include <iostream> #include <janus/vtime.h> -using namespace vt; +using namespace janus; using namespace std; int EXAM_IMPL(vtime_operations::vt_compare) @@ -180,7 +178,7 @@ vt1[t2] = 1; vt3 = vt1; - vt::sup( vt3, vt2 ); + janus::sup( vt3, vt2 ); EXAM_CHECK( vt3 <= vt1 ); EXAM_CHECK( vt1 <= vt3 ); @@ -188,7 +186,7 @@ vt2[t1] = 1; vt3 = vt1; - vt::sup( vt3, vt2 ); + janus::sup( vt3, vt2 ); EXAM_CHECK( vt3 <= vt1 ); EXAM_CHECK( vt1 <= vt3 ); @@ -196,7 +194,7 @@ vt2[t2] = 1; vt3 = vt1; - vt::sup( vt3, vt2 ); + janus::sup( vt3, vt2 ); EXAM_CHECK( vt3 <= vt1 ); EXAM_CHECK( vt1 <= vt3 ); @@ -204,7 +202,7 @@ vt2[t3] = 1; vt3 = vt1; - vt::sup( vt3, vt2 ); + janus::sup( vt3, vt2 ); vt4[t1] = 1; vt4[t2] = 1; @@ -221,7 +219,7 @@ vt4.clear(); vt3 = vt1; - vt::sup( vt3, vt2 ); + janus::sup( vt3, vt2 ); vt4[t1] = 1; vt4[t2] = 2; @@ -232,7 +230,7 @@ vt2[t3] = 4; vt3 = vt1; - vt::sup( vt3, vt2 ); + janus::sup( vt3, vt2 ); vt4[t3] = 4; Modified: trunk/complement/explore/lib/janus/ut/vt_remote.cc =================================================================== --- trunk/complement/explore/lib/janus/ut/vt_remote.cc 2007-08-16 19:20:06 UTC (rev 1683) +++ trunk/complement/explore/lib/janus/ut/vt_remote.cc 2007-08-17 06:47:44 UTC (rev 1684) @@ -1,9 +1,7 @@ -// -*- C++ -*- Time-stamp: <07/08/16 10:45:48 ptr> +// -*- C++ -*- Time-stamp: <07/08/17 10:07:52 ptr> #include "vt_operations.h" -// #include <boost/lexical_cast.hpp> - #include <iostream> #include <janus/vtime.h> @@ -18,10 +16,10 @@ using namespace std; using namespace stem; using namespace xmt; -using namespace vt; +using namespace janus; class YaRemote : - public vt::VTHandler + public janus::VTHandler { public: YaRemote(); @@ -50,7 +48,7 @@ xmt::condition cnd; xmt::condition gr; - DECLARE_RESPONSE_TABLE( YaRemote, vt::VTHandler ); + DECLARE_RESPONSE_TABLE( YaRemote, janus::VTHandler ); }; #define VS_DUMMY_MESS 0x1203 Modified: trunk/complement/explore/lib/janus/vtime.cc =================================================================== --- trunk/complement/explore/lib/janus/vtime.cc 2007-08-16 19:20:06 UTC (rev 1683) +++ trunk/complement/explore/lib/janus/vtime.cc 2007-08-17 06:47:44 UTC (rev 1684) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/08/11 01:10:59 ptr> +// -*- C++ -*- Time-stamp: <07/08/17 10:39:02 ptr> #include <janus/vtime.h> @@ -6,7 +6,7 @@ #include <stdint.h> #include <stem/EvManager.h> -namespace vt { +namespace janus { using namespace std; using namespace xmt; @@ -152,28 +152,28 @@ VSsync_rq::net_unpack( s ); } -void VTmess::pack( std::ostream& s ) const +void VSmess::pack( std::ostream& s ) const { __pack( s, code ); src.pack( s ); // __pack( s, src ); VSsync::pack( s ); } -void VTmess::net_pack( std::ostream& s ) const +void VSmess::net_pack( std::ostream& s ) const { __net_pack( s, code ); src.net_pack( s ); // __net_pack( s, src ); VSsync::net_pack( s ); } -void VTmess::unpack( std::istream& s ) +void VSmess::unpack( std::istream& s ) { __unpack( s, code ); src.unpack( s ); // __unpack( s, src ); VSsync::unpack( s ); } -void VTmess::net_unpack( std::istream& s ) +void VSmess::net_unpack( std::istream& s ) { __net_unpack( s, code ); src.net_unpack( s ); // __net_unpack( s, src ); @@ -349,7 +349,7 @@ namespace detail { -bool vtime_obj_rec::deliver( const VTmess& m ) +bool vtime_obj_rec::deliver( const VSmess& m ) { if ( order_correct( m ) ) { lvt[m.src] += m.gvt.gvt; @@ -361,7 +361,7 @@ return false; } -bool vtime_obj_rec::deliver_delayed( const VTmess& m ) +bool vtime_obj_rec::deliver_delayed( const VSmess& m ) { if ( order_correct_delayed( m ) ) { lvt[m.src] += m.gvt.gvt; @@ -373,17 +373,17 @@ return false; } -bool vtime_obj_rec::order_correct( const VTmess& m ) +bool vtime_obj_rec::order_correct( const VSmess& m ) { if ( groups.find( m.grp ) == groups.end() ) { - throw domain_error( "VT object not member of group" ); + throw domain_error( "virtual synchrony object not member of group" ); } gvtime gvt( m.gvt ); if ( (vt.gvt[m.grp][m.src] + 1) != gvt[m.grp][m.src] ) { if ( (vt.gvt[m.grp][m.src] + 1) > gvt[m.grp][m.src] ) { - throw out_of_range( "duplicate or wrong VT message" ); + throw out_of_range( "duplicate or wrong virtual synchrony message" ); } return false; } @@ -405,10 +405,10 @@ return true; } -ostream& vtime_obj_rec::trace_deliver( const VTmess& m, ostream& o ) +ostream& vtime_obj_rec::trace_deliver( const VSmess& m, ostream& o ) { if ( groups.find( m.grp ) == groups.end() ) { - return o << "VT object not member of group"; + return o << "virtual synchrony object not member of group"; } gvtime gvt( m.gvt ); @@ -437,7 +437,7 @@ return o << "should be delivered"; } -bool vtime_obj_rec::order_correct_delayed( const VTmess& m ) +bool vtime_obj_rec::order_correct_delayed( const VSmess& m ) { gvtime gvt( m.gvt ); @@ -473,7 +473,7 @@ // strike out group g from my groups list groups_container_type::iterator i = groups.find( g ); if ( i == groups.end() ) { - throw domain_error( "VT object not member of group" ); + throw domain_error( "virtual synchrony object not member of group" ); } groups.erase( i ); @@ -543,44 +543,44 @@ } // namespace detail -void VTDispatcher::settrf( unsigned f ) +void Janus::settrf( unsigned f ) { scoped_lock _x1( _lock_tr ); _trflags |= f; } -void VTDispatcher::unsettrf( unsigned f ) +void Janus::unsettrf( unsigned f ) { scoped_lock _x1( _lock_tr ); _trflags &= (0xffffffff & ~f); } -void VTDispatcher::resettrf( unsigned f ) +void Janus::resettrf( unsigned f ) { scoped_lock _x1( _lock_tr ); _trflags = f; } -void VTDispatcher::cleantrf() +void Janus::cleantrf() { scoped_lock _x1( _lock_tr ); _trflags = 0; } -unsigned VTDispatcher::trflags() const +unsigned Janus::trflags() const { scoped_lock _x1( _lock_tr ); return _trflags; } -void VTDispatcher::settrs( std::ostream *s ) +void Janus::settrs( std::ostream *s ) { scoped_lock _x1( _lock_tr ); _trs = s; } -void VTDispatcher::VTDispatch( const stem::Event_base<VTmess>& m ) +void Janus::JaDispatch( const stem::Event_base<VSmess>& m ) { pair<gid_map_type::const_iterator,gid_map_type::const_iterator> range = grmap.equal_range( m.value().grp ); @@ -621,7 +621,7 @@ } } -void VTDispatcher::check_and_send( detail::vtime_obj_rec& vt, const stem::Event_base<VTmess>& m ) +void Janus::check_and_send( detail::vtime_obj_rec& vt, const stem::Event_base<VSmess>& m ) { if ( vt.deliver( m.value() ) ) { stem::Event ev( m.value().code ); @@ -651,11 +651,11 @@ catch ( ... ) { } #endif // __FIT_VS_TRACE - vt.dpool.push_back( make_pair( xmt::timespec(xmt::timespec::now), new Event_base<VTmess>(m) ) ); // 0 should be timestamp + vt.dpool.push_back( make_pair( xmt::timespec(xmt::timespec::now), new Event_base<VSmess>(m) ) ); // 0 should be timestamp } } -void VTDispatcher::check_and_send_delayed( detail::vtime_obj_rec& vt ) +void Janus::check_and_send_delayed( detail::vtime_obj_rec& vt ) { typedef detail::vtime_obj_rec::dpool_t dpool_t; bool more; @@ -700,7 +700,7 @@ } while ( more ); } -void VTDispatcher::VTSend( const stem::Event& e, group_type grp ) +void Janus::JaSend( const stem::Event& e, group_type grp ) { // This method not called from Dispatch, but work on the same level and in the same // scope, so this lock (from stem::EventHandler) required here: @@ -714,7 +714,7 @@ if ( i != vtmap.end() && i->second.stem_addr() == e.src() ) { // for self detail::vtime_obj_rec& vt = i->second; const oid_type& from = o->second; - stem::Event_base<VTmess> m( VS_MESS ); + stem::Event_base<VSmess> m( VS_MESS ); m.value().src = from; // oid m.value().code = e.code(); m.value().mess = e.value(); @@ -787,7 +787,7 @@ throw domain_error( "VT object not member of group" ); // Error: not group member } -void VTDispatcher::Subscribe( stem::addr_type addr, oid_type oid, group_type grp ) +void Janus::Subscribe( stem::addr_type addr, oid_type oid, group_type grp ) { // See comment on top of VTSend above xmt::recursive_scoped_lock lk( this->_theHistory_lock ); @@ -820,7 +820,7 @@ grmap.insert( make_pair(grp,oid) ); } -void VTDispatcher::Unsubscribe( oid_type oid, group_type grp ) +void Janus::Unsubscribe( oid_type oid, group_type grp ) { // See comment on top of VTSend above xmt::recursive_scoped_lock lk( this->_theHistory_lock ); @@ -863,9 +863,9 @@ } } -void VTDispatcher::Unsubscribe( oid_type oid ) +void Janus::Unsubscribe( oid_type oid ) { - // See comment on top of VTSend above + // See comment on top of JaSend above xmt::recursive_scoped_lock lk( this->_theHistory_lock ); vt_map_type::iterator i = vtmap.find( oid ); @@ -909,9 +909,9 @@ } } -void VTDispatcher::get_gvtime( group_type grp, stem::addr_type addr, gvtime_type& gvt ) +void Janus::get_gvtime( group_type grp, stem::addr_type addr, gvtime_type& gvt ) { - // See comment on top of VTSend above + // See comment on top of JaSend above xmt::recursive_scoped_lock lk( this->_theHistory_lock ); pair<gid_map_type::iterator,gid_map_type::iterator> range = @@ -927,18 +927,18 @@ try { scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracefault) ) { - *_trs << "VT object not member of group" << " " << __FILE__ << ":" << __LINE__ << endl; + *_trs << "virtual synchrony object not member of group" << " " << __FILE__ << ":" << __LINE__ << endl; } } catch ( ... ) { } - throw domain_error( "VT object not member of group" ); // Error: not group member + throw domain_error( "virtual synchrony object not member of group" ); // Error: not group member } -void VTDispatcher::set_gvtime( group_type grp, stem::addr_type addr, const gvtime_type& gvt ) +void Janus::set_gvtime( group_type grp, stem::addr_type addr, const gvtime_type& gvt ) { - // See comment on top of VTSend above + // See comment on top of JaSend above xmt::recursive_scoped_lock lk( this->_theHistory_lock ); pair<gid_map_type::iterator,gid_map_type::iterator> range = @@ -966,21 +966,21 @@ try { scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracefault) ) { - *_trs << "VT object not member of group" << " " << __FILE__ << ":" << __LINE__ << endl; + *_trs << "virtual synchrony object not member of group" << " " << __FILE__ << ":" << __LINE__ << endl; } } catch ( ... ) { } - throw domain_error( "VT object not member of group" ); // Error: not group member + throw domain_error( "virtual synchrony object not member of group" ); // Error: not group member } -DEFINE_RESPONSE_TABLE( VTDispatcher ) - EV_Event_base_T_( ST_NULL, VS_MESS, VTDispatch, VTmess ) +DEFINE_RESPONSE_TABLE( Janus ) + EV_Event_base_T_( ST_NULL, VS_MESS, JaDispatch, VSmess ) END_RESPONSE_TABLE char *Init_buf[128]; -VTDispatcher *VTHandler::_vtdsp = 0; +Janus *VTHandler::_vtdsp = 0; static int *_rcount = 0; void VTHandler::Init::__at_fork_prepare() @@ -1013,7 +1013,7 @@ _rcount = &_count; pthread_atfork( __at_fork_prepare, __at_fork_parent, __at_fork_child ); #endif - VTHandler::_vtdsp = new VTDispatcher( 2, "vtd" ); + VTHandler::_vtdsp = new Janus( 2, "vtd" ); } } else { --_count; @@ -1030,10 +1030,10 @@ VTHandler::Init::~Init() { _guard( 0 ); } -void VTHandler::VTSend( const stem::Event& ev ) +void VTHandler::JaSend( const stem::Event& ev ) { ev.src( self_id() ); - _vtdsp->VTSend( ev, ev.dest() ); // throw domain_error, if not group member + _vtdsp->JaSend( ev, ev.dest() ); // throw domain_error, if not group member } VTHandler::VTHandler() : @@ -1112,14 +1112,14 @@ namespace std { -ostream& operator <<( ostream& o, const vt::vtime_type::value_type& v ) +ostream& operator <<( ostream& o, const janus::vtime_type::value_type& v ) { return o << "(" << v.first << "," << v.second << ")"; } -ostream& operator <<( ostream& o, const vt::vtime_type& v ) +ostream& operator <<( ostream& o, const janus::vtime_type& v ) { - for ( vt::vtime_type::const_iterator i = v.begin(); i != v.end(); ++i ) { + for ( janus::vtime_type::const_iterator i = v.begin(); i != v.end(); ++i ) { if ( i != v.begin() ) { o << ", "; } @@ -1128,29 +1128,29 @@ return o; } -ostream& operator <<( ostream& o, const vt::vtime& v ) +ostream& operator <<( ostream& o, const janus::vtime& v ) { return o << v.vt; } -ostream& operator <<( ostream& o, const vt::gvtime_type::value_type& v ) +ostream& operator <<( ostream& o, const janus::gvtime_type::value_type& v ) { o << v.first << ": " << v.second.vt; } -ostream& operator <<( ostream& o, const vt::gvtime_type& v ) +ostream& operator <<( ostream& o, const janus::gvtime_type& v ) { o << "{\n"; - for ( vt::gvtime_type::const_iterator i = v.begin(); i != v.end(); ++i ) { + for ( janus::gvtime_type::const_iterator i = v.begin(); i != v.end(); ++i ) { o << "\t" << *i << "\n"; } return o << "}\n"; } -ostream& operator <<( ostream& o, const vt::gvtime& v ) +ostream& operator <<( ostream& o, const janus::gvtime& v ) { return o << v.gvt; } -ostream& operator <<( ostream& o, const vt::VSsync& m ) +ostream& operator <<( ostream& o, const janus::VSsync& m ) { // ios_base::fmtflags f = o.flags( ios_base::hex ); o << "G" << m.grp << " " << m.gvt; @@ -1158,13 +1158,13 @@ return o; } -ostream& operator <<( ostream& o, const vt::VTmess& m ) +ostream& operator <<( ostream& o, const janus::VSmess& m ) { ios_base::fmtflags f = o.flags( ios_base::hex | ios_base::showbase ); - o << "C" << m.code << dec << " " << m.src << " " << static_cast<const vt::VSsync&>(m); + o << "C" << m.code << dec << " " << m.src << " " << static_cast<const janus::VSsync&>(m); o.flags( f ); return o; } -} // namespace std +} // namespace janus This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |