architecture to adopt

Discussion in 'C++' started by Vincent RICHOMME, Dec 22, 2005.

  1. Hi,

    I would like to learn a good object approach and to do so I have started
    to design an application used to manage smart cards.
    It's developped with a multi-plateform gui toolkit (wxWidgets)
    You can see a screenshot here :
    http://smartdev-info.com/IMG/png/SmartTester.png

    As you can see a SmartCardProject is composed of

    one or many Readers,
    one or many Card and each card is composed of CardCmds
    one or many script files
    So I did this :

    class SCardReader
    {
    public:
    SCardReader(wxString strRealName,
    wxString strUserName)
    :m_strRealName(strRealName),
    m_strUserName(strUserName)
    {
    }

    wxString m_strRealName;
    wxString m_strUserName;
    };


    WX_DEFINE_ARRAY(SCardReader*, SCardReaderArray);

    /*----------------------------------------------------------*/

    class SCardCmd
    {
    public:
    SCardCmd(const wxString& strCmdName);

    private:
    wxString m_strCLA;
    wxString m_strINS;
    wxString m_strP1;
    wxString m_strP2;
    wxString m_strLc;
    wxString m_strData;
    wxString m_strLe;
    wxString m_strResponse;
    wxString m_strSW;
    };
    WX_DECLARE_HASH_MAP(wxString, SCardCmd*,
    wxStringHash,wxStringEqual,SCardCmdHMap);

    /*----------------------------------------------------------*/
    class SCardDesc
    {
    public:

    protected:
    wxString strUserCardName;
    SCardCmdHMap m_scCmds;
    };
    WX_DECLARE_HASH_MAP(wxString, SCardDesc*,
    wxStringHash,wxStringEqual,SCardDescHMap);




    class ProjDockBar;

    class SCardPrj
    {
    public:

    SCardPrj() {}
    SCardPrj(ProjDockBar* pProjDockBar);
    virtual ~SCardPrj();

    void AddReader();
    void AddCardDesc();
    void AddCardCmd();
    void AddCardCmd(const wxString& strCardName);
    bool GetCardCmd(wxString strCardCmd, SCardCmd& refCardCmd);



    protected:


    void UpdateGUI();

    SCardReaderArray m_scReaders;
    SCardDescHMap m_scDesc;
    PrjTree* m_pPrjTree;
    };

    #endif


    My problem is about how can I associate my project and the GuiPart.
    For now when someone right-click on a CardCommand item I offer the
    choice to add a CardCommand, so I get a pointer on a Scardprj and I call
    AddCardCmd and this method update the Gui by calling a method
    belonging to my tree.

    The flow is :

    Gui(Project Tree) is requested to make a change --->SCardPrj is notified
    and do the action ---> Update Gui

    Is it the right way to do, actually since my Project Structure is almost
    the same as its Gui counterpart(Tree), is there a mean of coupling these
    two things ?
    Vincent RICHOMME, Dec 22, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    8
    Views:
    579
    Tonny Madsen
    May 15, 2007
  2. Erik Hollensbe

    X12::Parser - intent to adopt

    Erik Hollensbe, Dec 31, 2007, in forum: Perl
    Replies:
    2
    Views:
    2,421
    brian d foy
    Jan 1, 2008
  3. Ant Grinyer
    Replies:
    19
    Views:
    444
    Tom Anderson
    Jul 14, 2008
  4. Ant Grinyer
    Replies:
    10
    Views:
    522
    Ian Collins
    Jul 11, 2008
  5. Chris Dew
    Replies:
    103
    Views:
    783
    Frasier Mruby
    Oct 11, 2008
Loading...

Share This Page