GDCM
2.2.3
|
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 GDCMNETWORKSTATEID_H 00019 #define GDCMNETWORKSTATEID_H 00020 00021 namespace gdcm { 00022 namespace network { 00023 00032 enum EStateID { 00033 eStaDoesNotExist = 0, 00034 eSta1Idle = 1, 00035 eSta2Open = 2, 00036 eSta3WaitLocalAssoc = 4, 00037 eSta4LocalAssocDone = 8, 00038 eSta5WaitRemoteAssoc = 16, 00039 eSta6TransferReady = 32, 00040 eSta7WaitRelease = 64, 00041 eSta8WaitLocalRelease = 128, 00042 eSta9ReleaseCollisionRqLocal = 256, 00043 eSta10ReleaseCollisionAc = 512, 00044 eSta11ReleaseCollisionRq = 1024, 00045 eSta12ReleaseCollisionAcLocal = 2048, 00046 eSta13AwaitingClose = 4096 00047 }; 00048 00049 const int cMaxStateID = 13; 00050 00051 //the transition table is built on state indeces 00052 //this function will produce the index from the power-of-two EStateID 00053 inline int GetStateIndex(EStateID inState){ 00054 switch (inState){ 00055 case eStaDoesNotExist: 00056 default: 00057 return -1; 00058 case eSta1Idle: 00059 return 0; 00060 case eSta2Open: 00061 return 1; 00062 case eSta3WaitLocalAssoc: 00063 return 2; 00064 case eSta4LocalAssocDone: 00065 return 3; 00066 case eSta5WaitRemoteAssoc: 00067 return 4; 00068 case eSta6TransferReady: 00069 return 5; 00070 case eSta7WaitRelease: 00071 return 6; 00072 case eSta8WaitLocalRelease: 00073 return 7; 00074 case eSta9ReleaseCollisionRqLocal: 00075 return 8; 00076 case eSta10ReleaseCollisionAc: 00077 return 9; 00078 case eSta11ReleaseCollisionRq: 00079 return 10; 00080 case eSta12ReleaseCollisionAcLocal: 00081 return 11; 00082 case eSta13AwaitingClose: 00083 return 12; 00084 } 00085 } 00086 } 00087 } 00088 00089 #endif //GDCMNETWORKSTATEID_H