本文整理汇总了C++中Hdf::write方法的典型用法代码示例。如果您正苦于以下问题:C++ Hdf::write方法的具体用法?C++ Hdf::write怎么用?C++ Hdf::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hdf
的用法示例。
在下文中一共展示了Hdf::write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recordInput
void ReplayTransport::recordInput(Transport* transport, const char *filename) {
ASSERT(transport);
Hdf hdf;
hdf["thread"] = (int64)pthread_self();
hdf["get"] = (transport->getMethod() == GET);
hdf["url"] = transport->getUrl();
hdf["remote_host"] = transport->getRemoteHost();
transport->getHeaders(m_requestHeaders);
int index = 0;
for (HeaderMap::const_iterator iter = m_requestHeaders.begin();
iter != m_requestHeaders.end(); ++iter) {
for (unsigned int i = 0; i < iter->second.size(); i++) {
Hdf header = hdf["headers"][index++];
header["name"] = iter->first;
header["value"] = iter->second[i];
}
}
int size;
const void *data = transport->getPostData(size);
if (size) {
int len;
char *encoded = string_uuencode((const char *)data, size, len);
hdf["post"] = encoded;
free(encoded);
} else {
hdf["post"] = "";
}
hdf.write(filename);
}
示例2: recordInput
void ReplayTransport::recordInput(Transport* transport, const char *filename) {
assert(transport);
Hdf hdf;
char buf[32];
snprintf(buf, sizeof(buf), "%u", Process::GetProcessId());
hdf["pid"] = std::string(buf);
#ifdef _MSC_VER
snprintf(buf, sizeof(buf), "%" PRIx64,
(int64_t)pthread_getw32threadid_np(Process::GetThreadId()));
#else
snprintf(buf, sizeof(buf), "%" PRIx64, (int64_t)Process::GetThreadId());
#endif
hdf["tid"] = std::string(buf);
snprintf(buf, sizeof(buf), "%u", Process::GetThreadPid());
hdf["tpid"] = std::string(buf);
hdf["cmd"] = static_cast<int>(transport->getMethod());
hdf["url"] = transport->getUrl();
hdf["remote_host"] = transport->getRemoteHost();
hdf["remote_port"] = transport->getRemotePort();
transport->getHeaders(m_requestHeaders);
int index = 0;
for (HeaderMap::const_iterator iter = m_requestHeaders.begin();
iter != m_requestHeaders.end(); ++iter) {
for (unsigned int i = 0; i < iter->second.size(); i++) {
Hdf header = hdf["headers"][index++];
header["name"] = iter->first;
header["value"] = iter->second[i];
}
}
int size;
const void *data = transport->getPostData(size);
if (size) {
String encoded = string_uuencode((const char *)data, size);
hdf["post"] = encoded.get()->data();
} else {
hdf["post"] = "";
}
hdf.write(filename);
}
示例3: recordInput
void ReplayTransport::recordInput(Transport* transport, const char *filename) {
ASSERT(transport);
Hdf hdf;
char buf[32];
snprintf(buf, sizeof(buf), "%u", Process::GetProcessId());
hdf["pid"] = string(buf);
snprintf(buf, sizeof(buf), "%llx", (int64)Process::GetThreadId());
hdf["tid"] = string(buf);
snprintf(buf, sizeof(buf), "%u", Process::GetThreadPid());
hdf["tpid"] = string(buf);
hdf["cmd"] = transport->getMethod();
hdf["url"] = transport->getUrl();
hdf["remote_host"] = transport->getRemoteHost();
hdf["remote_port"] = transport->getRemotePort();
transport->getHeaders(m_requestHeaders);
int index = 0;
for (HeaderMap::const_iterator iter = m_requestHeaders.begin();
iter != m_requestHeaders.end(); ++iter) {
for (unsigned int i = 0; i < iter->second.size(); i++) {
Hdf header = hdf["headers"][index++];
header["name"] = iter->first;
header["value"] = iter->second[i];
}
}
int size;
const void *data = transport->getPostData(size);
if (size) {
int len;
char *encoded = string_uuencode((const char *)data, size, len);
hdf["post"] = encoded;
free(encoded);
} else {
hdf["post"] = "";
}
hdf.write(filename);
}