Select Git revision
-
Jorrit Schaap authoredJorrit Schaap authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
AttributeName.cpp 11.32 KiB
/* Copyright (C) : 2014-2019
European Synchrotron Radiation Facility
BP 220, Grenoble 38043, FRANCE
This file is part of libhdb++timescale.
libhdb++timescale is free software: you can redistribute it and/or modify
it under the terms of the Lesser GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libhdb++timescale is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser
GNU General Public License for more details.
You should have received a copy of the Lesser GNU General Public License
along with libhdb++timescale. If not, see <http://www.gnu.org/licenses/>. */
#include "AttributeName.hpp"
#include "LibUtils.hpp"
#include <netdb.h>
using namespace std;
namespace hdbpp_internal
{
//=============================================================================
//=============================================================================
AttributeName::AttributeName(const std::string &fqdn_attr_name)
{
set(fqdn_attr_name);
}
//=============================================================================
//=============================================================================
void AttributeName::set(const std::string &fqdn_attr_name)
{
// clear the cache and set the name
clear();
_fqdn_attr_name = fqdn_attr_name;
}
//=============================================================================
//=============================================================================
void AttributeName::clear() noexcept
{
_fqdn_attr_name.clear();
_full_attribute_name_cache.clear();
_tango_host_cache.clear();
_tango_host_with_domain_cache.clear();
_domain_cache.clear();
_family_cache.clear();
_member_cache.clear();
_attribute_name_cache.clear();
}
//=============================================================================
//=============================================================================
const string &AttributeName::tangoHost()
{
validate();
if (_tango_host_cache.empty())
{
// if tango:// exists on the string, strip it off by moving the start in 8 characters
auto start = _fqdn_attr_name.find("tango://") == string::npos ? 0 : 8;
auto end = _fqdn_attr_name.find('/', start);