HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UN_Wire.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UN_Wire.h ( UN Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __UN_Wire_h__
13 #define __UN_Wire_h__
14 
15 #include "UN_API.h"
16 #include "UN_Handle.h"
17 
18 class UN_Graph;
19 class UN_Port;
20 class UN_WireData;
21 
22 
23 // ============================================================================
24 /// A light-weight handle for a wire that connects two ports together.
25 ///
26 /// The actual wire data (UN_WireData) is owned and managed by UN_GraphData,
27 /// and UN_Wire serves as a handle for the client to refer to that data.
28 
29 class UN_API UN_Wire : public UN_Handle
30 {
31 public:
32  /// Convenience constructor for the wire handle.
33  UN_Wire( UN_GraphData *graph_data, UN_WireID wire_id );
34 
35  /// @{ Default constructors and assignment operators.
36  UN_Wire();
37  ~UN_Wire();
38  UN_Wire( const UN_Wire& other );
39  UN_Wire( UN_Wire&& other );
40  UN_Wire & operator=( const UN_Wire& other );
41  UN_Wire & operator=( UN_Wire&& other );
42  /// @}
43 
44  /// @{ Returns true if this is a valid wire; false otherwise.
45  bool isValid() const;
46  explicit operator bool() const
47  { return isValid(); }
48  /// @}
49 
50  /// @{ Comparison operators
51  bool operator==( const UN_Wire &other ) const
52  { return UN_Handle::operator==( other ); }
53  bool operator!=( const UN_Wire &other ) const
54  { return UN_Handle::operator!=( other ); }
55  /// @}
56 
57 
58  /// Returns the owner graph of this wire.
59  UN_Graph graph() const;
60 
61  /// Returns the source port of this wire.
62  /// (ie, port that produces and sends the data).
63  UN_Port srcPort() const;
64 
65  /// Returns the destination port of this wire.
66  /// (ie, port that receives and consumes the data).
67  UN_Port dstPort() const;
68 
69  /// Returns the unique ID of the wire data this handle refers to.
70  UN_WireID wireID() const
71  { return UN_WireID( dataID() ); }
72 
73 protected:
74  /// The wire data container for all the wires in the graph.
75  UN_WireData * wireData() const;
76 };
77 
78 #endif
79 
UN_DataID dataID() const
Definition: UN_Handle.h:66
#define UN_API
Definition: UN_API.h:11
bool operator==(const UN_Handle &other) const
Comparison operators.
Definition: UN_Handle.h:50
UN_WireID wireID() const
Returns the unique ID of the wire data this handle refers to.
Definition: UN_Wire.h:70
bool operator!=(const UN_Handle &other) const
Comparison operators.
Definition: UN_Handle.h:56
UN_Handle & operator=(const UN_Handle &)=default
Default destructor, constructors and assignment operators.
bool operator!=(const UN_Wire &other) const
Comparison operators.
Definition: UN_Wire.h:53
bool operator==(const UN_Wire &other) const
Comparison operators.
Definition: UN_Wire.h:51