Skip to content

Commit

Permalink
Formatting and clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-ganyushin committed Apr 16, 2024
1 parent c141a93 commit ba3a41e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 41 deletions.
12 changes: 3 additions & 9 deletions bindings/CXX11/adios2/cxx11/IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,10 @@ VariableNT IO::InquireVariable(const std::string &name)
}
}

/**
* @brief Returns the type of an existing variable as an string
* @param name input variable name
* @return type primitive type
*/
DataType IO::InquireVariableType(const std::string &name)
{
return (m_IO->InquireVariableType(name));
};

{
return (m_IO->InquireVariableType(name));
}

VariableNT IO::InquireStructVariable(const std::string &name)
{
Expand Down
1 change: 0 additions & 1 deletion bindings/CXX11/adios2/cxx11/IO.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ class IO
*/
DataType InquireVariableType(const std::string &name);


VariableNT InquireStructVariable(const std::string &name);

VariableNT InquireStructVariable(const std::string &name, const StructDefinition def);
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/engine/bp5/BP5Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include "adios2/toolkit/format/bp5/BP5Deserializer.h"
#include "adios2/toolkit/format/buffer/heap/BufferMalloc.h"
#include "adios2/toolkit/remote/Remote.h"
#include "adios2/toolkit/xrootd/Xrootd.h"
#include "adios2/toolkit/transportman/TransportMan.h"
#include "adios2/toolkit/xrootd/Xrootd.h"

#include <chrono>
#include <map>
Expand Down
24 changes: 8 additions & 16 deletions source/adios2/toolkit/xrootd/Xrootd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class myRequest : public XrdSsiRequest
}

static myRequest *currentRequest;
//TODODG private
char *responseBuffer;
int responseBufferLen;

Expand Down Expand Up @@ -244,8 +243,6 @@ void myRequest::ProcessResponseData(const XrdSsiErrInfo &eInfo, char *buff, int
if (dlen > 0)
{
totbytes += dlen;
/* if (clUI.doEcho && dlen < 80)
fwrite(buff, dlen, 1, XrdSsiCl::outFile); */
responseBuffer = new char [dlen];
responseBufferLen = dlen;
memcpy(responseBuffer, buff, dlen);
Expand All @@ -268,7 +265,7 @@ void myRequest::ProcessResponseData(const XrdSsiErrInfo &eInfo, char *buff, int
// because we were cancelled.
//
Finished();
// delete this;
// delete this;
}

/******************************************************************************/
Expand Down Expand Up @@ -311,16 +308,14 @@ extern XrdSsiProvider *XrdSsiProviderClient;
#endif
namespace adios2
{
Xrootd::Xrootd() {

}
Xrootd::Xrootd() {}
Xrootd::~Xrootd() {}
void Xrootd::Open(const std::string hostname, const int32_t port, const std::string filename,
const Mode mode, bool RowMajorOrdering)
{
#ifdef ADIOS2_HAVE_XROOTD
fileName = filename;
const std::string contact = hostname + ":" + std::to_string(port);
const std::string contact = hostname + ":" + std::to_string(port);
clUI.cmdName = strdup("adios:");
clUI.contact = strdup(contact.c_str());
if (!(clUI.ssiService = XrdSsiProviderClient->GetService(eInfo, contact.c_str())))
Expand All @@ -339,21 +334,20 @@ Xrootd::GetHandle Xrootd::Get(char *VarName, size_t Step, size_t BlockID, Dims &
char rName[512] = "/adios";
XrdSsiResource rSpec((std::string)rName);
myRequest *reqP;
std::string reqData = "get " + fileName + " " + std::string (VarName);
std::string reqData = "get " + fileName + " " + std::string(VarName);
reqData += "&" + std::to_string(Step);
reqData += "&" + std::to_string(BlockID);

for (auto& c : Count)
for (auto &c : Count)
{
reqData += "&" + std::to_string(c);
}

for (auto& s : Start)
for (auto &s : Start)
{
reqData += "&" + std::to_string(s);
}


// The first step is to define the resource we will be using. So, just
// initialize a resource object. It need only to exist during ProcessRequest()
//
Expand All @@ -371,18 +365,16 @@ Xrootd::GetHandle Xrootd::Get(char *VarName, size_t Step, size_t BlockID, Dims &
// calls. For our simple client we have no context so we simply always get a
// new object.
//
char* reqDataStr = strdup(reqData.c_str());
char *reqDataStr = strdup(reqData.c_str());
reqP = new myRequest(clUI, rName, GetReqID(), reqDataStr, reqLen);
reqP->SetResource(rSpec);
// We simply hand off the request to the service to deal with it. When a
// response is ready or an error occured our callback is invoked.
//
clUI.ssiService->ProcessRequest(*reqP, rSpec);
//thread synchronization
// thread synchronization
sleep(1);
memcpy(dest, reqP->responseBuffer, reqP->responseBufferLen);
//TODODG
// memory?
#endif
return 0;
}
Expand Down
25 changes: 11 additions & 14 deletions source/utils/xrootd-plugin/XrdSsiSvService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,15 @@ void XrdSsiSvService::ProcessRequest(XrdSsiRequest &reqRef, XrdSsiResource &resR
/******************************************************************************/
/* help function to split strings */
/******************************************************************************/
std::vector<std::string> split (const std::string &s, char delim) {
std::vector<std::string> split(const std::string &s, char delim)
{
std::vector<std::string> result;
std::stringstream ss (s);
std::stringstream ss(s);
std::string item;

while (getline (ss, item, delim)) {
result.push_back (item);
while (getline(ss, item, delim))
{
result.push_back(item);
}

return result;
Expand Down Expand Up @@ -446,13 +448,8 @@ void XrdSsiSvService::ProcessRequest4Me(XrdSsiRequest *rqstP)
RespondErr("Arguments are expected", EINVAL);
return;
}
// if ((quest = index(reqArgs, '?')))
// {
// Copy2Buff(respMeta, sizeof(respMeta), quest + 1, strlen(quest + 1) + 1);
// *quest = 0;
// }
/* parameters name, step, blockID, count0, count1, count2, ... start0, start1, start2 */
std::vector<std::string> requestParams = split (reqArgs, '&');
std::vector<std::string> requestParams = split(reqArgs, '&');

m_io = adios.DeclareIO("xtoord");
m_engine = m_io.Open(reqData, adios2::Mode::ReadRandomAccess);
Expand Down Expand Up @@ -490,10 +487,10 @@ void XrdSsiSvService::ProcessRequest4Me(XrdSsiRequest *rqstP)
ADIOS2_FOREACH_PRIMITIVE_STDTYPE_1ARG(GET)
#undef GET
}
catch (const std::exception &exc)
{
RespondErr("Returning exception for Get ", EINVAL);
}
catch (const std::exception &exc)
{
RespondErr("Returning exception for Get ", EINVAL);
}
// detached thread. Memory should not be deallocated yet,
// olnly of a thread is finished
return;
Expand Down

0 comments on commit ba3a41e

Please sign in to comment.