ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
IovSetDto Class Reference

#include <CrestModel.h>

Inheritance diagram for IovSetDto:
Collaboration diagram for IovSetDto:

Public Member Functions

const char * getFormat () const
 
int64_t getSize () const
 
std::vector< uint64_t > getListSince ()
 
json to_json () const
 
void load_from_json (const json &j)
 

Static Public Member Functions

static IovSetDto from_json (const json &j)
 
static IovSetDto from_fs_json (const json &j)
 

Public Attributes

std::vector< IovDtoresources
 
std::optional< std::string > datatype
 
std::optional< RespPagepage
 
std::optional< GenericMapfilter
 

Detailed Description

Definition at line 286 of file CrestModel.h.

Member Function Documentation

◆ from_fs_json()

IovSetDto IovSetDto::from_fs_json ( const json j)
static

Definition at line 531 of file CrestModel.cxx.

532 {
533  IovSetDto iovSet;
534  iovSet.load_from_json(j);
535  // int n = j.size();
536 
537  for (auto it = j.begin(); it != j.end(); ++it)
538  {
539  iovSet.resources.push_back(IovDto::from_json(*it));
540  }
541 
542  iovSet.datatype = "iovs";
543 
544  return iovSet;
545 }

◆ from_json()

IovSetDto IovSetDto::from_json ( const json j)
static

Definition at line 518 of file CrestModel.cxx.

519 {
520  IovSetDto iovSet;
521  iovSet.load_from_json(j);
522  json jsonResources = j.value("resources", json::array());
523  for (auto it = jsonResources.begin(); it != jsonResources.end(); ++it)
524  {
525  iovSet.resources.push_back(IovDto::from_json(*it));
526  }
527 
528  return iovSet;
529 }

◆ getFormat()

const char* IovSetDto::getFormat ( ) const
inlinevirtual

Implements CrestBaseResponse.

Definition at line 290 of file CrestModel.h.

290 {return "IovSetDto";}

◆ getListSince()

std::vector< uint64_t > IovSetDto::getListSince ( )

Definition at line 509 of file CrestModel.cxx.

509  {
510  std::vector<uint64_t> v;
511  for (IovDto item_iov: resources){
512  uint64_t since = item_iov.since;
513  v.emplace_back(since);
514  }
515  return v;
516 }

◆ getSize()

int64_t IovSetDto::getSize ( ) const
inlinevirtual

Implements CrestBaseResponse.

Definition at line 291 of file CrestModel.h.

291 {return resources.size();}

◆ load_from_json()

void CrestBaseResponse::load_from_json ( const json j)
inherited

Definition at line 85 of file CrestModel.cxx.

86 {
87  if (j.contains("datatype"))
88  datatype = j.value("datatype", "");
89  // Check for the presence of "page" key and create an optional
90  if (j.contains("page"))
91  {
92  if (!j["page"].is_null())
93  {
94  page = std::make_optional((RespPage::from_json(j["page"])));
95  }
96  }
97 
98  // Check for the presence of "filter" key and create an optional
99  filter = j.contains("filter") ? std::make_optional(GenericMap::from_json(j["filter"])) : std::nullopt;
100 }

◆ to_json()

json IovSetDto::to_json ( ) const

Definition at line 497 of file CrestModel.cxx.

498 {
499  json baseJson = CrestBaseResponse::to_json();
500  json jsonResources = json::array();
501  for (const auto &resource : resources)
502  {
503  jsonResources.push_back(((IovDto)resource).to_json());
504  }
505  baseJson["resources"] = jsonResources;
506  return baseJson;
507 }

Member Data Documentation

◆ datatype

std::optional<std::string> CrestBaseResponse::datatype
inherited

Definition at line 45 of file CrestModel.h.

◆ filter

std::optional<GenericMap> CrestBaseResponse::filter
inherited

Definition at line 47 of file CrestModel.h.

◆ page

std::optional<RespPage> CrestBaseResponse::page
inherited

Definition at line 46 of file CrestModel.h.

◆ resources

std::vector<IovDto> IovSetDto::resources

Definition at line 289 of file CrestModel.h.


The documentation for this class was generated from the following files:
IovSetDto::resources
std::vector< IovDto > resources
Definition: CrestModel.h:289
RespPage::from_json
static RespPage from_json(const json &j)
Definition: CrestModel.cxx:20
json
nlohmann::json json
Definition: HistogramDef.cxx:9
CrestBaseResponse::load_from_json
void load_from_json(const json &j)
Definition: CrestModel.cxx:85
IovDto
Definition: CrestModel.h:268
skel.it
it
Definition: skel.GENtoEVGEN.py:396
dq_defect_copy_defect_database.since
def since
Definition: dq_defect_copy_defect_database.py:54
CrestBaseResponse::filter
std::optional< GenericMap > filter
Definition: CrestModel.h:47
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
CrestBaseResponse::datatype
std::optional< std::string > datatype
Definition: CrestModel.h:45
lumiFormat.array
array
Definition: lumiFormat.py:91
python.PyAthena.v
v
Definition: PyAthena.py:154
IovSetDto
Definition: CrestModel.h:287
CrestBaseResponse::page
std::optional< RespPage > page
Definition: CrestModel.h:46
CrestBaseResponse::to_json
json to_json() const
Definition: CrestModel.cxx:54
IovDto::from_json
static IovDto from_json(const json &j)
Definition: CrestModel.cxx:456
GenericMap::from_json
static GenericMap from_json(const json &j)
Definition: CrestModel.cxx:41
IovSetDto::to_json
json to_json() const
Definition: CrestModel.cxx:497