Commit f78e0378 authored by hkrishna's avatar hkrishna

remote connection updates. Adding tag support to allow buffers written by...

remote connection updates. Adding tag support to allow buffers written by SocketConnection rather than directly.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@25390 18c085ea-50e0-402c-830e-de6fd14e8384
parent 7c8ae93f
......@@ -65,6 +65,12 @@ BufferConnection::Size()
return (long)(buffer.empty() ? 0 : buffer.size());
}
void
BufferConnection::Reset()
{
buffer.clear();
}
void
BufferConnection::Write(unsigned char value)
{
......
......@@ -68,6 +68,7 @@ public:
virtual int Fill();
virtual void Flush();
virtual long Size();
virtual void Reset();
virtual void Write(unsigned char value);
virtual void Read(unsigned char *address);
......
......@@ -78,6 +78,7 @@ public:
virtual int Fill() = 0;
virtual void Flush() = 0;
virtual long Size() = 0;
virtual void Reset() = 0; /// Reset Connection State
// These read or write a byte to whatever we're using
// as the connection.
......
......@@ -250,6 +250,33 @@ SocketConnection::SetFixedBufferMode(bool val)
#endif
}
// ****************************************************************************
// Method: SocketConnection::GetFixedBufferMode
//
// Purpose:
// Get the socket's fixed buffer mode.
//
// Arguments:
// val : Whether to do fixed buffer mode.
//
// Returns:
//
// Note: Fixed buffer mode is a communication style where we send
// fixed-size chunks of data that may contain smaller variable-length
// payloads.
//
// Programmer: Brad Whitlock
// Creation: Tue Oct 14 15:50:00 PDT 2014
//
// Modifications:
//
// ****************************************************************************
bool
SocketConnection::GetFixedBufferMode()
{
return fixedBufferMode;
}
// ****************************************************************************
// Method: SocketConnection::WaitForDescriptor
//
......@@ -616,6 +643,28 @@ SocketConnection::Size()
return (long)buffer.size();
}
// ****************************************************************************
// Method: SocketConnection::Reset
//
// Purpose:
// Resets the connection's buffer.
//
// Arguments:
// value : The character to append.
//
// Programmer: Brad Whitlock
// Creation: Tue Aug 29 12:19:23 PDT 2000
//
// Modifications:
//
// ****************************************************************************
void
SocketConnection::Reset()
{
buffer.clear();
}
// ****************************************************************************
// Method: SocketConnection::Write
//
......
......@@ -79,6 +79,7 @@ public:
virtual int Fill();
virtual void Flush();
virtual long Size();
virtual void Reset();
virtual void Write(unsigned char value);
virtual void Read(unsigned char *address);
virtual void Append(const unsigned char *buf, int count);
......@@ -90,6 +91,7 @@ public:
virtual int GetDescriptor() const;
void SetFixedBufferMode(bool val);
bool GetFixedBufferMode();
static const int FIXED_BUFFER_SIZE;
protected:
......@@ -113,7 +115,7 @@ public:
virtual void FlushAttr(AttributeSubject*) = 0;
virtual int Fill() = 0;
std::string serializeMetaData(AttributeSubject*);
std::string serializeAttributeSubject(AttributeSubject*);
static std::string serializeMetaData(AttributeSubject*);
static std::string serializeAttributeSubject(AttributeSubject*);
};
#endif
......@@ -207,50 +207,48 @@ AttributeSubjectSerialize::Flush(AttributeSubject *subject)
}
else {
SocketConnection* sconn = NULL;
sconn = dynamic_cast<SocketConnection*>(conn);
bool fixBufferMode = false;
if(sconn) {
fixBufferMode = sconn->GetFixedBufferMode();
sconn->SetFixedBufferMode(false);
}
conn->Reset();
JSONNode startTag;
startTag[0] = "startTag";
const std::string& start = startTag.ToString().c_str();
JSONNode endTag;
endTag[0] = "endTag";
const std::string& end = endTag.ToString().c_str();
if(subject->GetSendMetaInformation())
{
JSONNode meta;
JSONNode node;
conn->Append((const unsigned char *)start.c_str(), start.size());
const std::string& api = AttributeSubjectSocketConnection::serializeMetaData(subject);
conn->Append((const unsigned char *)api.c_str(), api.size());
conn->Append((const unsigned char *)end.c_str(), end.size());
subject->WriteAPI(meta);
node["id"] = subject->GetGuido();
node["typename"] = subject->TypeName();
node["api"] = meta;
const std::string& output = node.ToString().c_str();
#if defined(_WIN32)
send(conn->GetDescriptor(), (const char FAR *)output.c_str(), output.size(), 0);
#else
#ifdef MSG_NOSIGNAL
send(conn->GetDescriptor(), (const void *)output.c_str(), output.size(), MSG_NOSIGNAL);
#else
send(conn->GetDescriptor(), (const void *)output.c_str(), output.size(), 0);
#endif
#endif
}
JSONNode child, metadata;
JSONNode node;
subject->Write(child);
subject->WriteMetaData(metadata);
node["id"] = subject->GetGuido();
node["typename"] = subject->TypeName();
node["contents"] = child; //.ToJSONNode(false);
node["metadata"] = metadata; //.ToJSONNode(false);
const std::string& output = node.ToString().c_str();
#if defined(_WIN32)
send(conn->GetDescriptor(), (const char FAR *)output.c_str(), output.size(), 0);
#else
#ifdef MSG_NOSIGNAL
send(conn->GetDescriptor(), (const void *)output.c_str(), output.size(), MSG_NOSIGNAL);
#else
send(conn->GetDescriptor(), (const void *)output.c_str(), output.size(), 0);
#endif
#endif
conn->Append((const unsigned char *)start.c_str(), start.size());
const std::string& output = AttributeSubjectSocketConnection::serializeAttributeSubject(subject);
conn->Append((const unsigned char *)output.c_str(), output.size());
conn->Append((const unsigned char *)end.c_str(), end.size());
conn->Flush();
if(sconn) {
sconn->SetFixedBufferMode(fixBufferMode);
}
}
}
}
......
......@@ -415,7 +415,7 @@ avtALSFileFormat::GetTomoDataSet(hid_t file) {
dimsm[0] = 0;
dimsm[1] = dims_out[1];
dimsm[2] = dims_out[2];
dimsm[3] = zslices;
//dimsm[3] = zslices;
memspace = H5Screate_simple (4, dimsm, NULL);
......@@ -425,12 +425,12 @@ avtALSFileFormat::GetTomoDataSet(hid_t file) {
offset_out[0] = 0;
offset_out[1] = 0;
offset_out[2] = 0;
offset_out[3] = 0;
//offset_out[3] = 0;
count_out[0] = 0;
count_out[1] = dims_out[1];
count_out[2] = dims_out[2];
count_out[3] = zslices;
//count_out[3] = zslices;
status = H5Sselect_hyperslab (memspace, H5S_SELECT_SET, offset_out, NULL,
count_out, NULL);
......@@ -709,9 +709,9 @@ avtALSFileFormat::GetVar(int domain, const char *varname)
{
if(m_dataType == TOMO) {
std::string name = varname;
if(varname == "intensity1") m_ver = 0;
if(varname == "intensity2") m_ver = 1;
if(varname == "intensity3") m_ver = 2;
if(name == "intensity1") m_ver = 0;
if(name == "intensity2") m_ver = 1;
if(name == "intensity3") m_ver = 2;
}
return GetDataSet();
......
......@@ -92,6 +92,8 @@ class VIEWER_SUBJECT_PROXY_API ViewerSubjectProxy : public QObject, public Viewe
virtual int Fill(){ return 0; }
virtual void Flush(){}
virtual long Size(){ return 0; }
virtual void Reset() {}
virtual void Write(unsigned char value) {}
virtual void Read(unsigned char *address) {}
virtual void Append(const unsigned char *buf, int count){}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment