<
classASNClass >
71*err =
"Cannot open file for reading";
75unique_ptr<ncbi::CObjectIStream> inObject;
78inObject.reset(
newncbi::CObjectIStreamAsnBinary(inStream));
81inObject.reset(
newncbi::CObjectIStreamAsn(inStream));
88*inObject >> *ASNobject;
89}
catch(std::exception& e) {
100 template<
classASNClass >
101 bool WriteASNToFile(
const char*filename,
constASNClass& ASNobject,
boolisBinary,
110*err =
"Cannot open file for writing";
114unique_ptr<ncbi::CObjectOStream> outObject;
117outObject.reset(
newncbi::CObjectOStreamAsnBinary(outStream, fixNonPrint));
120outObject.reset(
newncbi::CObjectOStreamAsn(outStream, fixNonPrint));
127*outObject << ASNobject;
129}
catch(std::exception& e) {
141 template<
classASNClass >
145ASNClass *asnObject,
std::string*err,
boolbinaryData =
true,
unsigned shortport = 80)
152ncbi::CNcbiRegistry* reg =
newncbi::CNcbiRegistry;
159ncbi::CConn_HttpStream httpStream(host, path, args,
kEmptyStr, port);
160unique_ptr<ncbi::CObjectIStream> inObject;
162inObject.reset(
newncbi::CObjectIStreamAsnBinary(httpStream));
164inObject.reset(
newncbi::CObjectIStreamAsn(httpStream));
166*inObject >> *asnObject;
169}
catch(ncbi::CSerialException& se) {
170*err =
std::string(
"Data is not in expected format; error: ") + se.what();
171}
catch(std::exception& e) {
172*err =
std::string(
"Network connection failed or data is not in expected format; error: ") + e.what();
181 template<
classASNClass >
185 boolbinaryData =
true)
203hostCopy =
"https://"+ host.substr(7);
205hostCopy =
"https://"+ host;
207url = hostCopy + path +
"?"+ args;
215 if(err) *err =
"GetAsnDataViaHTTPS: Empty object pointer provided.";
226*inObject >> *asnObject;
230 catch(exception& e) {
bool GetAsnDataViaHTTP(const std::string &host, const std::string &path, const std::string &args, ASNClass *asnObject, std::string *err, bool binaryData=true, unsigned short port=80)
bool GetAsnDataViaHTTPS(const std::string &host, const std::string &path, const std::string &args, ASNClass *asnObject, std::string *err, bool binaryData=true)
bool WriteASNToFile(const char *filename, const ASNClass &ASNobject, bool isBinary, std::string *err, ncbi::EFixNonPrint fixNonPrint=ncbi::eFNP_Default)
bool ReadASNFromFile(const char *filename, ASNClass *ASNobject, bool isBinary, std::string *err)
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
Include a standard set of the NCBI C++ Toolkit most basic headers.
The NCBI C++ standard methods for dealing with std::string.
std::ofstream out("events_result.xml")
main entry point for tests
void SetDiagTrace(EDiagTrace how, EDiagTrace dflt=eDT_Default)
Set the diagnostic trace settings.
@ eDT_Disable
Ignore messages of severity "eDiag_Trace".
@ eDT_Default
Restores the default tracing context.
EFixNonPrint
How to process non-printing character in the ASN VisibleString.
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
void CORE_SetREG(REG rg)
Set the registry (no registry if "rg" is passed zero) â to be used by the core internals.
REG REG_cxx2c(IRWRegistry *reg, bool pass_ownership=false)
Convert a C++ Toolkit registry object to a REG registry.
#define REG_CONN_DEBUG_PRINTOUT
REG CORE_GetREG(void)
Get the registry that is to be used by the core internals.
#define REG_CONN_REQ_METHOD
#define DEF_CONN_REG_SECTION
Defines NCBI C++ diagnostic APIs, classes, and macros.
Defines NCBI C++ exception handling.
The NCBI C++/STL use hints.
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
std::istream & in(std::istream &in_, double &x_)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4