open-dis-cpp
EntityID.h
1 #pragma once
2 
3 #include <dis6/utils/DataStream.h>
4 #include <dis6/opendis6_export.h>
5 
6 
7 namespace DIS
8 {
9 // Each entity in a given DIS simulation application shall be given an entity identifier number unique to all other entities in that application. This identifier number is valid for the duration of the exercise; however, entity identifier numbers may be reused when all possible numbers have been exhausted. No entity shall have an entity identifier number of NO_ENTITY, ALL_ENTITIES, or RQST_ASSIGN_ID. The entity iden- tifier number need not be registered or retained for future exercises. The entity identifier number shall be specified by a 16-bit unsigned integer. An entity identifier number equal to zero with valid site and application identification shall address a simulation application. An entity identifier number equal to ALL_ENTITIES shall mean all entities within the specified site and application. An entity identifier number equal to RQST_ASSIGN_ID allows the receiver of the create entity to define the entity identifier number of the new entity.
10 
11 // Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved.
12 //
13 // @author DMcG, jkg
14 
15 class OPENDIS6_EXPORT EntityID
16 {
17 protected:
19  unsigned short _site;
20 
22  unsigned short _application;
23 
25  unsigned short _entity;
26 
27 
28  public:
29  EntityID();
30  virtual ~EntityID();
31 
32  virtual void marshal(DataStream& dataStream) const;
33  virtual void unmarshal(DataStream& dataStream);
34 
35  unsigned short getSite() const;
36  void setSite(unsigned short pX);
37 
38  unsigned short getApplication() const;
39  void setApplication(unsigned short pX);
40 
41  unsigned short getEntity() const;
42  void setEntity(unsigned short pX);
43 
44 
45 virtual int getMarshalledSize() const;
46 
47  bool operator ==(const EntityID& rhs) const;
48 };
49 }
50 
51 // Copyright (c) 1995-2009 held by the author(s). All rights reserved.
52 // Redistribution and use in source and binary forms, with or without
53 // modification, are permitted provided that the following conditions
54 // are met:
55 //
56 // * Redistributions of source code must retain the above copyright
57 // notice, this list of conditions and the following disclaimer.
58 // * Redistributions in binary form must reproduce the above copyright
59 // notice, this list of conditions and the following disclaimer
60 // in the documentation and/or other materials provided with the
61 // distribution.
62 // * Neither the names of the Naval Postgraduate School (NPS)
63 // Modeling Virtual Environments and Simulation (MOVES) Institute
64 // (http://www.nps.edu and http://www.MovesInstitute.org)
65 // nor the names of its contributors may be used to endorse or
66 // promote products derived from this software without specific
67 // prior written permission.
68 //
69 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
70 // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
71 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
72 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
73 // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
74 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
75 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
76 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
77 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
78 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
79 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
80 // POSSIBILITY OF SUCH DAMAGE.
Symbolic names as defined in 5.1.4.
Definition: AcknowledgePdu.h:8
unsigned short _application
The application ID.
Definition: EntityID.h:22
a class to support managing a network buffer.
Definition: DataStream.h:28
unsigned short _site
The site ID.
Definition: EntityID.h:19
unsigned short _entity
the entity ID
Definition: EntityID.h:25
Definition: EntityID.h:15