GDCM 2.2.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

gdcmULTransitionTable.h
Go to the documentation of this file.

    00001 /*=========================================================================
    00002  *
    00003  *  Copyright Insight Software Consortium
    00004  *
    00005  *  Licensed under the Apache License, Version 2.0 (the "License");
    00006  *  you may not use this file except in compliance with the License.
    00007  *  You may obtain a copy of the License at
    00008  *
    00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
    00010  *
    00011  *  Unless required by applicable law or agreed to in writing, software
    00012  *  distributed under the License is distributed on an "AS IS" BASIS,
    00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  *  See the License for the specific language governing permissions and
    00015  *  limitations under the License.
    00016  *
    00017  *=========================================================================*/
    00018 #ifndef GDCMULTRANSITIONTABLE_H
    00019 #define GDCMULTRANSITIONTABLE_H
    00020
    00021 #include "gdcmNetworkStateID.h"
    00022 #include "gdcmNetworkEvents.h"
    00023 #include "gdcmULAction.h"
    00024
    00025 #include <cstdlib>  // NULL
    00026
    00027 namespace gdcm {
    00028 class Subject;
    00029   namespace network{
    00030 class ULConnection;
    00031 class ULAction;
    00032 class ULEvent;
    00033
    00034     //The transition dictates the action that should be taken from the start state to the end state
    00035     struct Transition {
    00036       int mEnd;
    00037       ULAction* mAction;
    00038       Transition(){
    00039         mEnd = eStaDoesNotExist;
    00040         mAction = NULL;
    00041       }
    00042       ~Transition(){
    00043         if (mAction != NULL){
    00044           delete mAction;
    00045           mAction = NULL;
    00046         }
    00047       }
    00048       Transition(int inEndState, ULAction* inAction){
    00049         mEnd = inEndState;
    00050         mAction = inAction;
    00051       }
    00052       static Transition* MakeNew(int inEndState, ULAction* inAction){
    00053         return new Transition(inEndState, inAction);
    00054       }
    00055     };
    00056
    00057     //used to define a row in table 9-10 of 3.8 2009
    00058     //the transition table is events, then state,
    00059     //then the transition itself (which has the event
    00060     //and start state implied by their starting locations)
    00061     //don't need to store the event; that's implicitly defined in the Table itself by location
    00062     class TableRow{
    00063     public:
    00064       Transition transitions[cMaxStateID];
    00065
    00066       //copy constructor for stl additions into the transition table below.
    00067     };
    00068
    00085 class ULTransitionTable
    00086 {
    00087     private:
    00088       TableRow mTable[cMaxEventID];
    00089     public:
    00090       ULTransitionTable();
    00091
    00092       void HandleEvent(Subject*s,ULEvent& inEvent, ULConnection& inConnection,
    00093         bool& outWaitingForEvent, EEventID& outRaisedEvent) const;
    00094
    00095       void PrintTable() const; //so that the table can be printed and verified against the DICOM standard
    00096     };
    00097   }
    00098 }
    00099 #endif // GDCMULTRANSITIONTABLE_H