delegation-set-lite.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
22 #ifndef NDN_DELEGATION_SET_LITE_HPP
23 #define NDN_DELEGATION_SET_LITE_HPP
24 
25 #include "name-lite.hpp"
26 #include "../c/delegation-set-types.h"
27 
28 namespace ndn {
29 
31 public:
33  public:
44  Delegation(ndn_NameComponent* nameComponents, size_t maxNameComponents);
45 
50  int
51  getPreference() const { return preference; }
52 
57  NameLite&
58  getName() { return NameLite::downCast(name); }
59 
60  const NameLite&
61  getName() const { return NameLite::downCast(name); }
62 
63  void
64  setPreference(int preference) { this->preference = preference; }
65 
72  ndn_Error
73  set(const Delegation& other);
74 
81  static Delegation&
83  {
84  return *(Delegation*)&delegation;
85  }
86 
87  static const Delegation&
88  downCast(const ndn_DelegationSet_Delegation& delegation)
89  {
90  return *(Delegation*)&delegation;
91  }
92 
93  private:
94  // Declare friends who can downcast to the private base.
95  friend class Tlv0_1_1WireFormatLite;
96 
102  Delegation(const Delegation& other);
103 
109  Delegation& operator=(const Delegation& other);
110  };
111 };
112 
113 }
114 
115 #endif
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
A NameLite holds an array of NameLite::Component.
Definition: name-lite.hpp:34
Copyright (C) 2015-2016 Regents of the University of California.
Definition: name-types.h:33
Delegation(ndn_NameComponent *nameComponents, size_t maxNameComponents)
Create a DelegationSetLite::Delegation with the pre-allocated nameComponents, and defaults for all th...
Definition: delegation-set-lite.cpp:28
A Tlv0_1_1WireFormatLite implements implement encoding and decoding using NDN-TLV version 0...
Definition: tlv-0_1_1-wire-format-lite.hpp:41
static Delegation & downCast(ndn_DelegationSet_Delegation &delegation)
Downcast the reference to the ndn_DelegationSet_Delegation struct to a DelegationSetLite::Delegation...
Definition: delegation-set-lite.hpp:82
Definition: delegation-set-lite.hpp:30
int getPreference() const
Get the preference number.
Definition: delegation-set-lite.hpp:51
NameLite & getName()
Get the delegation name.
Definition: delegation-set-lite.hpp:58
Copyright (C) 2016 Regents of the University of California.
Definition: delegation-set-types.h:33
Definition: delegation-set-lite.hpp:32
static NameLite & downCast(ndn_Name &name)
Downcast the reference to the ndn_Name struct to a NameLite.
Definition: name-lite.hpp:429
ndn_Error set(const Delegation &other)
Set this delegation to have the values from the other delegation.
Definition: delegation-set-lite.cpp:35