-/*\r
-* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
-*\r
-* This file is part of CasparCG (www.casparcg.com).\r
-*\r
-* CasparCG is free software: you can redistribute it and/or modify\r
-* it under the terms of the GNU General Public License as published by\r
-* the Free Software Foundation, either version 3 of the License, or\r
-* (at your option) any later version.\r
-*\r
-* CasparCG is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
-*\r
-* Author: Nicklas P Andersson\r
-*/\r
-\r
-#pragma once\r
-\r
-#include "../util/protocolstrategy.h"\r
-#include <core/video_channel.h>\r
-\r
-#include "AMCPCommand.h"\r
-#include "AMCPCommandQueue.h"\r
-\r
-#include <boost/noncopyable.hpp>\r
-\r
-namespace caspar { namespace protocol { namespace amcp {\r
-\r
-class AMCPProtocolStrategy : public IO::IProtocolStrategy, boost::noncopyable\r
-{\r
- enum MessageParserState {\r
- New = 0,\r
- GetSwitch,\r
- GetCommand,\r
- GetParameters,\r
- GetChannel,\r
- Done\r
- };\r
-\r
- AMCPProtocolStrategy(const AMCPProtocolStrategy&);\r
- AMCPProtocolStrategy& operator=(const AMCPProtocolStrategy&);\r
-\r
-public:\r
- AMCPProtocolStrategy(const std::vector<safe_ptr<core::video_channel>>& channels);\r
- virtual ~AMCPProtocolStrategy();\r
-\r
- virtual void Parse(const TCHAR* pData, int charCount, IO::ClientInfoPtr pClientInfo);\r
- virtual UINT GetCodepage() {\r
- return CP_UTF8;\r
- }\r
-\r
- AMCPCommandPtr InterpretCommandString(const std::wstring& str, MessageParserState* pOutState=0);\r
-\r
-private:\r
- friend class AMCPCommand;\r
-\r
- void ProcessMessage(const std::wstring& message, IO::ClientInfoPtr& pClientInfo);\r
- std::size_t TokenizeMessage(const std::wstring& message, std::vector<std::wstring>* pTokenVector);\r
- AMCPCommandPtr CommandFactory(const std::wstring& str);\r
-\r
- bool QueueCommand(AMCPCommandPtr);\r
-\r
- std::vector<safe_ptr<core::video_channel>> channels_;\r
- std::vector<AMCPCommandQueuePtr> commandQueues_;\r
- static const std::wstring MessageDelimiter;\r
-};\r
-\r
-}}}\r
+/*
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
+*
+* This file is part of CasparCG (www.casparcg.com).
+*
+* CasparCG is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* CasparCG is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
+*
+* Author: Nicklas P Andersson
+*/
+
+#pragma once
+
+#include "../util/protocolstrategy.h"
+#include <core/video_channel.h>
+
+#include "AMCPCommand.h"
+#include "AMCPCommandQueue.h"
+
+#include <boost/noncopyable.hpp>
+
+#include <string>
+
+namespace caspar { namespace protocol { namespace amcp {
+
+class AMCPProtocolStrategy : public IO::IProtocolStrategy, boost::noncopyable
+{
+ enum MessageParserState {
+ New = 0,
+ GetSwitch,
+ GetCommand,
+ GetParameters,
+ GetChannel,
+ Done
+ };
+
+ AMCPProtocolStrategy(const AMCPProtocolStrategy&);
+ AMCPProtocolStrategy& operator=(const AMCPProtocolStrategy&);
+
+public:
+ AMCPProtocolStrategy(const std::vector<spl::shared_ptr<core::video_channel>>& channels);
+ virtual ~AMCPProtocolStrategy();
+
+ virtual void Parse(const TCHAR* pData, int charCount, IO::ClientInfoPtr pClientInfo);
+ virtual std::string GetCodepage() {
+ return "UTF-8";
+ }
+
+ AMCPCommandPtr InterpretCommandString(const std::wstring& str, MessageParserState* pOutState=0);
+
+private:
+ friend class AMCPCommand;
+
+ void ProcessMessage(const std::wstring& message, IO::ClientInfoPtr& pClientInfo);
+ std::size_t TokenizeMessage(const std::wstring& message, std::vector<std::wstring>* pTokenVector);
+ AMCPCommandPtr CommandFactory(const std::wstring& str);
+
+ bool QueueCommand(AMCPCommandPtr);
+
+ std::vector<spl::shared_ptr<core::video_channel>> channels_;
+ std::vector<AMCPCommandQueuePtr> commandQueues_;
+ static const std::wstring MessageDelimiter;
+};
+
+}}}