it compiles

pull/1/head
Tom Early 3 years ago
parent 991d4899a0
commit ee0664dab7

@ -38,15 +38,6 @@ CCallsign::CCallsign()
m_coded = 0; m_coded = 0;
} }
CCallsign::CCallsign(const CCallsign &cs)
{
m_Callsign.l = cs.m_Callsign.l;
m_Suffix.u = cs.m_Suffix.u;
m_Module = cs.m_Module;
if (m_Callsign.l)
CSIn();
}
CCallsign::CCallsign(const std::string &cs, uint32_t dmrid, uint16_t nxdnid) : CCallsign() CCallsign::CCallsign(const std::string &cs, uint32_t dmrid, uint16_t nxdnid) : CCallsign()
{ {
// and populate // and populate
@ -222,7 +213,7 @@ void CCallsign::SetCallsign(const std::string &s, bool updateids)
} }
} }
void CCallsign::SetCallsign(const uint8_t *buffer, int len, bool UpdateDmrid) void CCallsign::SetCallsign(const uint8_t *buffer, int len, bool updateids)
{ {
// set callsign // set callsign
memset(m_Callsign.c, ' ', CALLSIGN_LEN); memset(m_Callsign.c, ' ', CALLSIGN_LEN);
@ -240,7 +231,7 @@ void CCallsign::SetCallsign(const uint8_t *buffer, int len, bool UpdateDmrid)
m_Module = (char)buffer[CALLSIGN_LEN-1]; m_Module = (char)buffer[CALLSIGN_LEN-1];
} }
CSIn(); CSIn();
if ( UpdateDmrid ) if (updateids)
{ {
auto key = GetKey(); auto key = GetKey();
g_LDid.Lock(); g_LDid.Lock();
@ -344,7 +335,7 @@ void CCallsign::PatchCallsign(int off, const char *patch, int len)
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// get // get
const UCallsign CCallsign::GetKey() const UCallsign CCallsign::GetKey() const
{ {
UCallsign rval; UCallsign rval;
rval.l = 0; rval.l = 0;

@ -72,7 +72,7 @@ public:
void PatchCallsign(int, const char *, int); void PatchCallsign(int, const char *, int);
// get // get
const UCallsign GetKey() const; UCallsign GetKey() const;
void GetCallsign(uint8_t *) const; void GetCallsign(uint8_t *) const;
void GetCallsignString(char *) const; void GetCallsignString(char *) const;
const std::string GetCS() const; const std::string GetCS() const;

@ -37,6 +37,14 @@ struct CCallsignHash
} }
}; };
struct CCallsignEqual
{
bool operator() (const UCallsign &ucs1, const UCallsign &ucs2) const
{
return ucs1.l == ucs2.l;
}
};
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////

@ -37,7 +37,7 @@ void CLookupDmr::LoadParameters()
m_Url.assign(g_Conf.GetString(g_Keys.dmriddb.url)); m_Url.assign(g_Conf.GetString(g_Keys.dmriddb.url));
} }
const uint32_t CLookupDmr::FindDmrid(const UCallsign &ucs) const uint32_t CLookupDmr::FindDmrid(const UCallsign &ucs) const
{ {
auto found = m_DmridMap.find(ucs); auto found = m_DmridMap.find(ucs);
if ( found != m_DmridMap.end() ) if ( found != m_DmridMap.end() )

@ -24,7 +24,7 @@ class CLookupDmr : public CLookup
{ {
public: public:
~CLookupDmr() {} ~CLookupDmr() {}
const uint32_t FindDmrid(const UCallsign &ucs) const; uint32_t FindDmrid(const UCallsign &ucs) const;
const UCallsign *FindCallsign(uint32_t dmrid) const; const UCallsign *FindCallsign(uint32_t dmrid) const;
protected: protected:
@ -34,5 +34,5 @@ protected:
private: private:
std::unordered_map<uint32_t, UCallsign> m_CallsignMap; std::unordered_map<uint32_t, UCallsign> m_CallsignMap;
std::unordered_map<UCallsign, uint32_t, CCallsignHash> m_DmridMap; std::unordered_map<UCallsign, uint32_t, CCallsignHash, CCallsignEqual> m_DmridMap;
}; };

@ -47,7 +47,7 @@ const UCallsign *CLookupNxdn::FindCallsign(uint16_t nxdnid) const
return nullptr; return nullptr;
} }
const uint16_t CLookupNxdn::FindNXDNid(const UCallsign &ucs) const uint16_t CLookupNxdn::FindNXDNid(const UCallsign &ucs) const
{ {
auto found = m_NxdnidMap.find(ucs); auto found = m_NxdnidMap.find(ucs);
if ( found != m_NxdnidMap.end() ) if ( found != m_NxdnidMap.end() )
@ -64,7 +64,7 @@ void CLookupNxdn::UpdateContent(std::stringstream &ss, Eaction action)
{ {
bool failed = true; bool failed = true;
auto l = atol(line.c_str()); // no throw guarantee auto l = atol(line.c_str()); // no throw guarantee
if (0 < l && l < 0x10000UL) if (0 < l && l < 0x10000)
{ {
auto id = uint32_t(l); auto id = uint32_t(l);
auto p1 = line.find(','); auto p1 = line.find(',');

@ -23,7 +23,7 @@
class CLookupNxdn : public CLookup class CLookupNxdn : public CLookup
{ {
public: public:
const uint16_t FindNXDNid(const UCallsign &ucs) const; uint16_t FindNXDNid(const UCallsign &ucs) const;
const UCallsign *FindCallsign(const uint16_t id) const; const UCallsign *FindCallsign(const uint16_t id) const;
protected: protected:
void ClearContents(); void ClearContents();
@ -32,5 +32,5 @@ protected:
private: private:
std::unordered_map <uint32_t, UCallsign> m_CallsignMap; std::unordered_map <uint32_t, UCallsign> m_CallsignMap;
std::unordered_map <UCallsign, uint32_t, CCallsignHash> m_NxdnidMap; std::unordered_map <UCallsign, uint32_t, CCallsignHash, CCallsignEqual> m_NxdnidMap;
}; };

@ -21,7 +21,7 @@
#include "YSFNode.h" #include "YSFNode.h"
#include "Lookup.h" #include "Lookup.h"
using CsNodeMap = std::unordered_map<UCallsign, CYsfNode, CCallsignHash>; using CsNodeMap = std::unordered_map<UCallsign, CYsfNode, CCallsignHash, CCallsignEqual>;
class CLookupYsf : public CLookup class CLookupYsf : public CLookup
{ {

@ -161,7 +161,7 @@ int main(int argc, char *argv[])
// define the action // define the action
case 'p': case 'p':
if (Eaction::err_only == action) if (Eaction::error_only == action)
{ {
std::cerr << "You can't specify both -p and -q!\n"; std::cerr << "You can't specify both -p and -q!\n";
usage(std::cerr, argv[0]); usage(std::cerr, argv[0]);
@ -179,7 +179,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE; return EXIT_FAILURE;
} }
else else
action = Eaction::err_only; action = Eaction::error_only;
break; break;
// finally // finally

Loading…
Cancel
Save

Powered by TurnKey Linux.