Improve incapsulation. Yep, finally.
[novacoin.git] / src / protocol.h
index 06165d8..352a247 100644 (file)
@@ -3,10 +3,6 @@
 // Distributed under the MIT/X11 software license, see the accompanying
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 
-#ifndef __cplusplus
-# error This header can only be compiled as C++.
-#endif
-
 #ifndef __INCLUDED_PROTOCOL_H__
 #define __INCLUDED_PROTOCOL_H__
 
@@ -24,12 +20,11 @@ inline uint16_t GetDefaultPort()
     return static_cast<uint16_t>(fTestNet ? 17777 : 7777);
 }
 
-/** Message header.
- * (4) network identifier.
- * (12) command.
- * (4) size.
- * (4) checksum.
- */
+// Message header.
+// (4) network identifier.
+// (12) command.
+// (4) size.
+// (4) checksum.
 class CMessageHeader
 {
     public:
@@ -123,10 +118,13 @@ class CInv
         const char* GetCommand() const;
         std::string ToString() const;
 
+        int GetType() const { return type; }
+        uint256 GetHash() const { return hash; }
+
     // TODO: make private (improves encapsulation)
-    public:
-        int type;
-        uint256 hash;
+    private:
+        int type = 0;
+        uint256 hash = 0;
 };
 
 #endif // __INCLUDED_PROTOCOL_H__