📄 eventspaceinst.h
字号:
//////////////////////////////////////////////////////////////////////////// Copyright (c) 2000, Yusuke Miyao/// You may distribute under the terms of the Artistic License.////// <id>$Id: EventSpaceInst.h,v 1.4 2003/05/14 09:13:10 yusuke Exp $</id>/// <collection>Maximum Entropy Estimator</collection>/// <name>EventSpaceInst.h</name>/// <overview>Instances of EventSpace</overview>/////////////////////////////////////////////////////////////////////////#ifndef Amis_EventSpaceInst_h_#define Amis_EventSpaceInst_h_#include <amis/Event.h>#include <amis/EventSpace.h>#include <amis/VectorOnFile.h>#include <vector>AMIS_NAMESPACE_BEGIN///////////////////////////////////////////////////////////////////////// <classdef>/// <name>EventSpaceInst</name>/// <overview>Instance of EventSpace</overview>/// <desc>An implementation of EventSpace</desc>/// <body>template < class Feature >class EventSpaceInst : public EventSpace< Feature, Event< Feature > > {public: EventSpaceInst( void ) {} virtual ~EventSpaceInst() {}};/// </body>/// </classdef>///////////////////////////////////////////////////////////////////////// <classdef>/// <name>EventSpaceOnMemory</name>/// <overview>Instance of EventSpace</overview>/// <desc>On-memory implementation of EventSpace</desc>/// <body>template < class Feature >class EventSpaceOnMemory : public EventSpaceInst< Feature > {private: std::vector< Event< Feature > > event_vector;protected: void push( Event< Feature >& event ) { /* event_vector.push_back( Event< Feature >() ); event_vector.back().swap( event ); */ event_vector.push_back( event ); } /// Push a new event to an event spacepublic: EventSpaceOnMemory( void ) {} /// Constructor for EventSpaceOnMemory virtual ~EventSpaceOnMemory() {} /// Destructor for EventSpaceOnMemory const std::string eventSpaceName( void ) const { return "EventSpaceOnMemory<" + Feature::featureTypeName() + ">"; } /// Get the name of this class const Event< Feature >& operator[]( int i ) const { return event_vector[ i ]; } /// Get the i-th event};/// </body>/// </classdef>///////////////////////////////////////////////////////////////////////// <classdef>/// <name>EventSpaceOnFile</name>/// <overview>Class for an event space on a file</overview>/// <desc>An implementation of EventSpace on a file</desc>/// <body>template < class Feature >class EventSpaceOnFile : public EventSpaceInst< Feature > {private: VectorOnFile< Event< Feature > > event_vector;protected: void push( Event< Feature >& event ) { event_vector.push_back( event ); } /// Push a new event to an event spacepublic: EventSpaceOnFile( objstream* s ) : event_vector( s ) { //std::cerr << s << std::endl; } /// Constructor for EventSpaceOnFile virtual ~EventSpaceOnFile() {} /// Destructor for EventSpaceOnFile const std::string eventSpaceName( void ) const { return "EventSpaceOnFile<" + Feature::featureTypeName() + ">"; } /// Get the name of this class const Event< Feature >& operator[]( int i ) const { return event_vector[ i ]; } /// Get the i-th event};AMIS_NAMESPACE_END/// </body>/// </classdef>#endif // EventSpaceInst_h_// end of EventSpaceInst.h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -