Skip to content

Commit

Permalink
Add message constant definitions to Message
Browse files Browse the repository at this point in the history
  • Loading branch information
lamyj committed Jun 15, 2015
1 parent a2f0918 commit b4071ea
Show file tree
Hide file tree
Showing 31 changed files with 140 additions and 130 deletions.
7 changes: 2 additions & 5 deletions src/dcmtkpp/CEchoRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#include "CEchoRequest.h"

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmnet/dimse.h>

#include "dcmtkpp/Request.h"
#include "dcmtkpp/registry.h"
#include "dcmtkpp/Value.h"
Expand All @@ -23,15 +20,15 @@ ::CEchoRequest(
Value::Integer message_id, Value::String const & affected_sop_class_uid)
: Request(message_id)
{
this->set_command_field(DIMSE_C_ECHO_RQ);
this->set_command_field(Command::C_ECHO_RQ);
this->set_affected_sop_class_uid(affected_sop_class_uid);
}

CEchoRequest
::CEchoRequest(Message const & message)
: Request(message)
{
if(message.get_command_field() != DIMSE_C_ECHO_RQ)
if(message.get_command_field() != Command::C_ECHO_RQ)
{
throw Exception("Message is not a C-ECHO-RQ");
}
Expand Down
7 changes: 2 additions & 5 deletions src/dcmtkpp/CEchoResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#include "CEchoResponse.h"

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmnet/dimse.h>

#include "dcmtkpp/Exception.h"
#include "dcmtkpp/registry.h"
#include "dcmtkpp/Response.h"
Expand All @@ -25,15 +22,15 @@ ::CEchoResponse(
Value::String const & affected_sop_class_uid)
: Response(message_id_being_responded_to, status)
{
this->set_command_field(DIMSE_C_ECHO_RSP);
this->set_command_field(Command::C_ECHO_RSP);
this->set_affected_sop_class_uid(affected_sop_class_uid);
}

CEchoResponse
::CEchoResponse(Message const & message)
: Response(message)
{
if(message.get_command_field() != DIMSE_C_ECHO_RSP)
if(message.get_command_field() != Command::C_ECHO_RSP)
{
throw Exception("Message is not a C-ECHO-RSP");
}
Expand Down
7 changes: 2 additions & 5 deletions src/dcmtkpp/CFindRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

#include <string>

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmnet/dimse.h>

#include "dcmtkpp/Exception.h"
#include "dcmtkpp/registry.h"
#include "dcmtkpp/Request.h"
Expand All @@ -27,7 +24,7 @@ ::CFindRequest(
Value::Integer priority, DataSet const & dataset)
: Request(message_id)
{
this->set_command_field(DIMSE_C_FIND_RQ);
this->set_command_field(Command::C_FIND_RQ);
this->set_affected_sop_class_uid(affected_sop_class_uid);
this->set_priority(priority);
if(dataset.empty())
Expand All @@ -41,7 +38,7 @@ CFindRequest
::CFindRequest(Message const & message)
: Request(message)
{
if(message.get_command_field() != DIMSE_C_FIND_RQ)
if(message.get_command_field() != Command::C_FIND_RQ)
{
throw Exception("Message is not a C-FIND-RQ");
}
Expand Down
10 changes: 3 additions & 7 deletions src/dcmtkpp/CFindResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@

#include "CFindResponse.h"

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmnet/dimse.h>
#include <dcmtk/ofstd/oftypes.h>

#include "dcmtkpp/DataSet.h"
#include "dcmtkpp/Exception.h"
#include "dcmtkpp/registry.h"
Expand All @@ -26,7 +22,7 @@ ::CFindResponse(
Value::Integer message_id_being_responded_to, Value::Integer status)
: Response(message_id_being_responded_to, status)
{
this->set_command_field(DIMSE_C_FIND_RSP);
this->set_command_field(Command::C_FIND_RSP);
}

CFindResponse
Expand All @@ -35,15 +31,15 @@ ::CFindResponse(
DataSet const & dataset)
: Response(message_id_being_responded_to, status)
{
this->set_command_field(DIMSE_C_FIND_RSP);
this->set_command_field(Command::C_FIND_RSP);
this->set_data_set(dataset);
}

CFindResponse
::CFindResponse(Message const & message)
: Response(message)
{
if(message.get_command_field() != DIMSE_C_FIND_RSP)
if(message.get_command_field() != Command::C_FIND_RSP)
{
throw Exception("Message is not a C-FIND-RSP");
}
Expand Down
7 changes: 2 additions & 5 deletions src/dcmtkpp/CGetRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

#include <string>

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmnet/dimse.h>

#include "dcmtkpp/DataSet.h"
#include "dcmtkpp/Exception.h"
#include "dcmtkpp/registry.h"
Expand All @@ -28,7 +25,7 @@ ::CGetRequest(
Value::Integer priority, DataSet const & dataset)
: Request(message_id)
{
this->set_command_field(DIMSE_C_GET_RQ);
this->set_command_field(Command::C_GET_RQ);
this->set_affected_sop_class_uid(affected_sop_class_uid);
this->set_priority(priority);
if(dataset.empty())
Expand All @@ -42,7 +39,7 @@ CGetRequest
::CGetRequest(Message const & message)
: Request(message)
{
if(message.get_command_field() != DIMSE_C_GET_RQ)
if(message.get_command_field() != Command::C_GET_RQ)
{
throw Exception("Message is not a C-GET-RQ");
}
Expand Down
9 changes: 3 additions & 6 deletions src/dcmtkpp/CGetResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#include "CGetResponse.h"

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmnet/dimse.h>

#include "dcmtkpp/DataSet.h"
#include "dcmtkpp/Exception.h"
#include "dcmtkpp/registry.h"
Expand All @@ -25,7 +22,7 @@ ::CGetResponse(
Value::Integer message_id_being_responded_to, Value::Integer status)
: Response(message_id_being_responded_to, status)
{
this->set_command_field(DIMSE_C_GET_RSP);
this->set_command_field(Command::C_GET_RSP);
}

CGetResponse
Expand All @@ -34,15 +31,15 @@ ::CGetResponse(
DataSet const & dataset)
: Response(message_id_being_responded_to, status)
{
this->set_command_field(DIMSE_C_GET_RSP);
this->set_command_field(Command::C_GET_RSP);
this->set_data_set(dataset);
}

CGetResponse
::CGetResponse(Message const & message)
: Response(message)
{
if(message.get_command_field() != DIMSE_C_GET_RSP)
if(message.get_command_field() != Command::C_GET_RSP)
{
throw Exception("Message is not a C-GET-RSP");
}
Expand Down
7 changes: 2 additions & 5 deletions src/dcmtkpp/CMoveRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#include "CMoveRequest.h"

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmnet/dimse.h>

#include "dcmtkpp/DataSet.h"
#include "dcmtkpp/Exception.h"
#include "dcmtkpp/registry.h"
Expand All @@ -27,7 +24,7 @@ ::CMoveRequest(
DataSet const & dataset)
: Request(message_id)
{
this->set_command_field(DIMSE_C_MOVE_RQ);
this->set_command_field(Command::C_MOVE_RQ);
this->set_affected_sop_class_uid(affected_sop_class_uid);
this->set_priority(priority);
this->set_move_destination(move_destination);
Expand All @@ -42,7 +39,7 @@ CMoveRequest
::CMoveRequest(Message const & message)
: Request(message)
{
if(message.get_command_field() != DIMSE_C_MOVE_RQ)
if(message.get_command_field() != Command::C_MOVE_RQ)
{
throw Exception("Message is not a C-MOVE-RQ");
}
Expand Down
9 changes: 3 additions & 6 deletions src/dcmtkpp/CMoveResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#include "CMoveResponse.h"

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmnet/dimse.h>

#include "dcmtkpp/DataSet.h"
#include "dcmtkpp/Exception.h"
#include "dcmtkpp/registry.h"
Expand All @@ -25,7 +22,7 @@ ::CMoveResponse(
Value::Integer message_id_being_responded_to, Value::Integer status)
: Response(message_id_being_responded_to, status)
{
this->set_command_field(DIMSE_C_MOVE_RSP);
this->set_command_field(Command::C_MOVE_RSP);
}

CMoveResponse
Expand All @@ -34,15 +31,15 @@ ::CMoveResponse(
DataSet const & dataset)
: Response(message_id_being_responded_to, status)
{
this->set_command_field(DIMSE_C_MOVE_RSP);
this->set_command_field(Command::C_MOVE_RSP);
this->set_data_set(dataset);
}

CMoveResponse
::CMoveResponse(Message const & message)
: Response(message)
{
if(message.get_command_field() != DIMSE_C_MOVE_RSP)
if(message.get_command_field() != Command::C_MOVE_RSP)
{
throw Exception("Message is not a C-MOVE-RSP");
}
Expand Down
9 changes: 2 additions & 7 deletions src/dcmtkpp/CStoreRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

#include <string>

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmdata/dcdeftag.h>
#include <dcmtk/dcmnet/dimse.h>
#include <dcmtk/ofstd/oftypes.h>

#include "dcmtkpp/ElementAccessor.h"
#include "dcmtkpp/Exception.h"
#include "dcmtkpp/Request.h"
Expand All @@ -29,7 +24,7 @@ ::CStoreRequest(
Value::Integer priority, DataSet const & dataset)
: Request(message_id)
{
this->set_command_field(DIMSE_C_STORE_RQ);
this->set_command_field(Command::C_STORE_RQ);
this->set_affected_sop_class_uid(affected_sop_class_uid);
this->set_affected_sop_instance_uid(affected_sop_instance_uid);
this->set_priority(priority);
Expand All @@ -45,7 +40,7 @@ CStoreRequest
::CStoreRequest(Message const & message)
: Request(message)
{
if(message.get_command_field() != DIMSE_C_STORE_RQ)
if(message.get_command_field() != Command::C_STORE_RQ)
{
throw Exception("Message is not a C-STORE-RQ");
}
Expand Down
7 changes: 2 additions & 5 deletions src/dcmtkpp/CStoreResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#include "CStoreResponse.h"

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmnet/dimse.h>

#include "dcmtkpp/Exception.h"
#include "dcmtkpp/registry.h"
#include "dcmtkpp/Response.h"
Expand All @@ -24,14 +21,14 @@ ::CStoreResponse(
Value::Integer message_id_being_responded_to, Value::Integer status)
: Response(message_id_being_responded_to, status)
{
this->set_command_field(DIMSE_C_STORE_RSP);
this->set_command_field(Command::C_STORE_RSP);
}

CStoreResponse
::CStoreResponse(Message const & message)
: Response(message)
{
if(message.get_command_field() != DIMSE_C_STORE_RSP)
if(message.get_command_field() != Command::C_STORE_RSP)
{
throw Exception("Message is not a C-STORE-RSP");
}
Expand Down
7 changes: 2 additions & 5 deletions src/dcmtkpp/Cancellation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#include "dcmtkpp/Cancellation.h"

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmnet/dimse.h>

#include "dcmtkpp/Exception.h"
#include "dcmtkpp/Message.h"
#include "dcmtkpp/registry.h"
Expand All @@ -23,14 +20,14 @@ Cancellation
::Cancellation(Uint16 message_id_being_responded_to)
: Message()
{
this->set_command_field(DIMSE_C_CANCEL_RQ);
this->set_command_field(Command::C_CANCEL_RQ);
this->set_message_id_being_responded_to(message_id_being_responded_to);
}

Cancellation
::Cancellation(Message const & message)
{
if(message.get_command_field() != DIMSE_C_CANCEL_RQ)
if(message.get_command_field() != Command::C_CANCEL_RQ)
{
throw Exception("Message is not a C-CANCEL-RQ");
}
Expand Down
4 changes: 2 additions & 2 deletions src/dcmtkpp/FindSCU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include <vector>

#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmdata/dcdatset.h>
#include <dcmtk/dcmnet/dimse.h>

#include "dcmtkpp/DataSet.h"
#include "dcmtkpp/Exception.h"
#include "dcmtkpp/CFindRequest.h"
#include "dcmtkpp/CFindResponse.h"
Expand All @@ -35,7 +35,7 @@ ::find(DataSet const & query, Callback callback) const
{
CFindRequest request(
this->_association->get_association()->nextMsgID++,
this->_affected_sop_class, DIMSE_PRIORITY_MEDIUM, query);
this->_affected_sop_class, Message::Priority::MEDIUM, query);
this->_send(request, this->_affected_sop_class);

// Receive the responses
Expand Down
6 changes: 3 additions & 3 deletions src/dcmtkpp/GetSCU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ::get(DataSet const & query, Callback callback) const
{
// Send the request
CGetRequest request(this->_association->get_association()->nextMsgID++,
this->_affected_sop_class, DIMSE_PRIORITY_MEDIUM, query);
this->_affected_sop_class, Message::Priority::MEDIUM, query);
this->_send(request, this->_affected_sop_class);

// Receive the responses
Expand All @@ -45,11 +45,11 @@ ::get(DataSet const & query, Callback callback) const
{
Message const message = this->_receive();

if(message.get_command_field() == DIMSE_C_GET_RSP)
if(message.get_command_field() == Message::Command::C_GET_RSP)
{
done = this->_get_response(CGetResponse(message));
}
else if(message.get_command_field() == DIMSE_C_STORE_RQ)
else if(message.get_command_field() == Message::Command::C_STORE_RQ)
{
try
{
Expand Down

0 comments on commit b4071ea

Please sign in to comment.