Blame view

GUI/SW2/SRC/src/netlist/Component.hpp 4.81 KB
886c558b   Steve Greedy   SACAMOS Public Re...
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
//**************************************************************************************************
//                                          Component.hpp                                          *
//                                         ---------------                                         *
// Description : This class processes a component definition line from a  netlist. The line is     *
//               parsed into it's constituant parts.                                               *
// Started     : 2004-05-14                                                                        *
// Last Update : 2015-03-07                                                                        *
// Copyright   : (C) 2004-2016 MSWaters                                                            *
//**************************************************************************************************

//**************************************************************************************************
//                                                                                                 *
//      This program is free software; you can redistribute it and/or modify it under the          *
//      terms of the GNU General Public License as published by the Free Software Foundation;      *
//      either version 3 of the License, or (at your option) any later version.                    *
//                                                                                                 *
//**************************************************************************************************

#ifndef COMPONENT_HPP
#define COMPONENT_HPP

// Application Include Files

#include "TypeDefs.hpp"
#include "utility/CnvtType.hpp"
#include "utility/StrUtils.hpp"

// wxWidgets Include Files

#include <wx/tokenzr.h>

//**************************************************************************************************

class Component : public wxString
{
  protected :

    // The following attributes are the minumum required to define a component
    wxString       m_osName;
    wxArrayString  m_osaNodes;
    wxString       m_osValue;

    // The following attributes are derived from the above attributes
    eTypeCpnt      m_eType;
    wxArrayString  m_osaPorts;                               // ??? Not yet implemented

    // Error message string
    wxString       m_osErrMsg;

    virtual  bool  bParseValue ( void ) { return( true ); }  // ??? Not yet implemented
    virtual  bool  bFormatValue( void ) { return( true ); }  // ??? Not yet implemented
    virtual  bool  bValidate   ( void );

             void  GetPorts( void );                         // ??? Not yet implemented

  public :

    // Function which provides the Component sorting criterion
    static   int   iCompare( Component ** ppo1, Component ** ppo2 );

                   Component( void );
    virtual       ~Component( );

    virtual  bool  bClear  ( void );
             bool  bIsValid( void ) { return( m_osErrMsg.IsEmpty( ) ); }

    virtual  bool  bParse ( void );
    virtual  bool  bFormat( void );

             bool  bSetString( const wxString & rosCmd    );
             bool  bSetName  ( const wxString & rosName   );
             bool  bSetNodes ( const wxString & rosNodes  );
             bool  bSetValue ( const wxString & rosValue  );
             bool  bSetErrMsg( const wxString & rosErrMsg );

            const  wxString      &  rosGetString   ( void );
    inline  const  wxString      &  rosGetName     ( void ) { return( m_osName   ); }
    inline  const  wxArrayString & rosaGetNodes    ( void ) { return( m_osaNodes ); }
    inline  const  wxString      &  rosGetValue    ( void ) { return( m_osValue  ); }
                   eTypeCpnt          eGetType     ( void ) { return( m_eType    ); }
            const  wxString      &  rosGetNodes    ( void );
            const  wxString      &  rosGetNumValue ( void );
                   eTypeUnits         eGetUnitsType( void ) { return( eGetUnitsType( m_osName ) ); }
    inline  const  wxString      &  rosGetErrMsg   ( void ) { return( m_osErrMsg ); }

    // Static helper functions (may be called without instantiating the class)
    static         eTypeCpnt   eGetType     ( const wxString & rosName );
    static         eTypeUnits  eGetUnitsType( const wxString & rosName );
    static  const  wxString &  rosTrim      ( const wxString & rosDefn );

    wxString  & operator = ( const wxString  & rosCmd );
    Component & operator = ( const Component & roCpnt );

             void  Print( const wxString & rosPrefix=wxT("  ") );
};

//**************************************************************************************************
// Define a new array type

WX_DECLARE_OBJARRAY( Component, ArrayComponent );

//**************************************************************************************************

#endif // COMPONENT_HPP