File: igstkSerialCommunicatingTrackerConfigurationXMLFileReader.h

package info (click to toggle)
igstk 4.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 38,980 kB
  • sloc: cpp: 86,267; xml: 96; makefile: 75; python: 38
file content (111 lines) | stat: -rw-r--r-- 3,978 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*=========================================================================

  Program:   Image Guided Surgery Software Toolkit
  Module:    $RCSfile: igstkSerialCommunicatingTrackerConfigurationXMLFileReader.h,v $
  Language:  C++
  Date:      $Date: 2009-01-30 20:48:03 $
  Version:   $Revision: 1.1 $

  Copyright (c) ISC  Insight Software Consortium.  All rights reserved.
  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#ifndef __igstkSerialCommunicatingTrackerConfigurationXMLFileReader_h
#define __igstkSerialCommunicatingTrackerConfigurationXMLFileReader_h

#include <itkXMLFile.h>
#include "igstkTrackerConfigurationXMLFileReaderBase.h"


namespace igstk
{
/** \class SerialCommunicatingTrackerConfigurationXMLFileReader
 * 
 *  \brief This class is an abstract reader for xml files containing a 
 *         tracker configuration that uses serial communication. 
 * 
 *         This class is an abstract reader for xml files containing a 
 *         tracker configuration that uses serial communication. 
 *         The specific type of tracker is defined by the subclass.
 */
class SerialCommunicatingTrackerConfigurationXMLFileReader : 
   public TrackerConfigurationXMLFileReaderBase 
{
public:

  //standard typedefs
  typedef SerialCommunicatingTrackerConfigurationXMLFileReader    Self;
  typedef TrackerConfigurationXMLFileReaderBase                   Superclass;
  typedef itk::SmartPointer<Self>                                 Pointer;

  //run-time type information (and related methods)
  itkTypeMacro( SerialCommunicatingTrackerConfigurationXMLFileReader, 
                TrackerConfigurationXMLFileReaderBase );

  /**
   * Method called when a new xml tag start is encountered.
   */
  virtual void StartElement( const char * name, const char **atts ); 

  /**
   * Method called when an xml tag end is encountered.
   */
  virtual void EndElement( const char *name ); 


protected:
  //this is the constructor that is called by the factory to 
  //create a new object
  SerialCommunicatingTrackerConfigurationXMLFileReader() : 
         TrackerConfigurationXMLFileReaderBase(),
         m_ReadingSerialCommunication( false ),
         m_HaveComPort( false ),  
         m_HaveBaudRate( false ),  
         m_HaveDataBits( false ),  
         m_HaveParity( false ),  
         m_HaveStopBits( false ),  
         m_HaveHandshake( false ) { }

  virtual ~SerialCommunicatingTrackerConfigurationXMLFileReader() { }

  void ProcessComport() throw ( FileFormatException );
  void ProcessBaudRate() throw ( FileFormatException );
  void ProcessDataBits() throw ( FileFormatException );
  void ProcessParity() throw ( FileFormatException );
  void ProcessStopBits() throw ( FileFormatException );
  void ProcessHandShake() throw ( FileFormatException );


  bool m_ReadingSerialCommunication;

  igstk::SerialCommunication::PortNumberType m_COMPort;
  igstk::SerialCommunication::BaudRateType   m_BaudRate;
  igstk::SerialCommunication::DataBitsType   m_DataBits;
  igstk::SerialCommunication::ParityType     m_Parity;
  igstk::SerialCommunication::StopBitsType   m_StopBits;
  igstk::SerialCommunication::HandshakeType  m_Handshake;

  bool m_HaveComPort;
  bool m_HaveBaudRate;
  bool m_HaveDataBits;
  bool m_HaveParity;
  bool m_HaveStopBits;
  bool m_HaveHandshake;

private:
  SerialCommunicatingTrackerConfigurationXMLFileReader( 
    const SerialCommunicatingTrackerConfigurationXMLFileReader & other );


  const SerialCommunicatingTrackerConfigurationXMLFileReader & operator=( 
    const SerialCommunicatingTrackerConfigurationXMLFileReader & right );
};


}
#endif //__igstkSerialCommunicatingTrackerConfigurationXMLFileReader_h