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

#include <CrestModel.h>

Inheritance diagram for PayloadSetDto:
Collaboration diagram for PayloadSetDto:

Public Member Functions

const char * getFormat () const
 
int64_t getSize () const
 
json to_json () const
 
void load_from_json (const json &j)
 

Static Public Member Functions

static PayloadSetDto from_json (const json &j)
 

Public Attributes

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

Detailed Description

Definition at line 365 of file CrestModel.h.

Member Function Documentation

◆ from_json()

PayloadSetDto PayloadSetDto::from_json ( const json j)
static

Definition at line 658 of file CrestModel.cxx.

659 {
660  PayloadSetDto payloadSetDto;
661  payloadSetDto.load_from_json(j);
662  json jsonResources = j.value("resources", json::array());
663  for (auto it = jsonResources.begin(); it != jsonResources.end(); ++it)
664  {
665  payloadSetDto.resources.push_back(PayloadDto::from_json(*it));
666  }
667 
668  return payloadSetDto;
669 }

◆ getFormat()

const char* PayloadSetDto::getFormat ( ) const
inlinevirtual

Implements CrestBaseResponse.

Definition at line 369 of file CrestModel.h.

369 {return "PayloadSetDto";}

◆ getSize()

int64_t PayloadSetDto::getSize ( ) const
inlinevirtual

Implements CrestBaseResponse.

Definition at line 370 of file CrestModel.h.

370 {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 PayloadSetDto::to_json ( ) const

Definition at line 644 of file CrestModel.cxx.

645 {
646  json baseJson = CrestBaseResponse::to_json();
647  json jsonResources = json::array();
648  for (const auto &resource : resources)
649  {
650  jsonResources.push_back(((PayloadDto)resource).to_json());
651  }
652  baseJson["resources"] = jsonResources;
653  return baseJson;
654 }

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<PayloadDto> PayloadSetDto::resources

Definition at line 368 of file CrestModel.h.


The documentation for this class was generated from the following files:
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
PayloadSetDto::resources
std::vector< PayloadDto > resources
Definition: CrestModel.h:368
skel.it
it
Definition: skel.GENtoEVGEN.py:396
PayloadDto
Definition: CrestModel.h:345
CrestBaseResponse::filter
std::optional< GenericMap > filter
Definition: CrestModel.h:47
PayloadDto::from_json
static PayloadDto from_json(const json &j)
Definition: CrestModel.cxx:627
PayloadSetDto::to_json
json to_json() const
Definition: CrestModel.cxx:644
CrestBaseResponse::datatype
std::optional< std::string > datatype
Definition: CrestModel.h:45
lumiFormat.array
array
Definition: lumiFormat.py:91
PayloadSetDto
Definition: CrestModel.h:366
CrestBaseResponse::page
std::optional< RespPage > page
Definition: CrestModel.h:46
CrestBaseResponse::to_json
json to_json() const
Definition: CrestModel.cxx:54
GenericMap::from_json
static GenericMap from_json(const json &j)
Definition: CrestModel.cxx:41