GridFileWrapper.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package MemoryX::CommonStorage
17 * @author Alexey Kozlov ( kozlov at kit dot edu)
18 * @date 2012
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
25 #include <memory>
26 #include <mutex>
27 
28 #include <MemoryX/interface/core/GridFileInterface.h>
29 
30 namespace mongo
31 {
32  class GridFile;
33 }
34 
35 namespace memoryx
36 {
37  using GridFilePtr = std::shared_ptr<mongo::GridFile>;
38 
39  class GridFileWrapper : public memoryx::GridFileInterface
40  {
41  public:
42  GridFileWrapper(const mongo::GridFile& gridFile,
43  const std::shared_ptr<std::mutex>& accessGridFSFilesMutex);
44  ~GridFileWrapper() override;
45 
46  // implement methods of GridFileInterface
47  ::std::string getId(const ::Ice::Current& = Ice::emptyCurrent) override;
48 
49  ::std::string getFilename(const ::Ice::Current& = Ice::emptyCurrent) override;
50 
51  ::std::string getMD5(const ::Ice::Current& = Ice::emptyCurrent) override;
52 
53  ::Ice::Long getFileSize(const ::Ice::Current& = Ice::emptyCurrent) override;
54 
55  ::Ice::Long getUploadDate(const ::Ice::Current& = Ice::emptyCurrent) override;
56 
57  ::Ice::Int getNextChunk(::memoryx::Blob& buffer,
58  const ::Ice::Current& = Ice::emptyCurrent) override;
59 
60  // helper methods
61  Ice::Identity getIceId() const;
62 
63  private:
64  GridFilePtr gridFile;
65  int nextChunkNo;
66 
67  Ice::Identity iceId;
68  std::shared_ptr<std::mutex> accessGridFSFilesMutex;
69  };
70 
72 
73 } // namespace memoryx
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::GridFileWrapper::getIceId
Ice::Identity getIceId() const
Definition: GridFileWrapper.cpp:117
memoryx::GridFileWrapper::getFileSize
::Ice::Long getFileSize(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GridFileWrapper.cpp:64
mongo
Definition: CommonStorage.h:35
IceInternal::Handle
Definition: forward_declarations.h:8
memoryx::GridFileWrapper::getUploadDate
::Ice::Long getUploadDate(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GridFileWrapper.cpp:70
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:570
memoryx::GridFileWrapper::getId
::std::string getId(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GridFileWrapper.cpp:46
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:918
memoryx::GridFileWrapper::getNextChunk
::Ice::Int getNextChunk(::memoryx::Blob &buffer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GridFileWrapper.cpp:76
memoryx::GridFileWrapper::~GridFileWrapper
~GridFileWrapper() override
memoryx::GridFileWrapper
Definition: GridFileWrapper.h:39
memoryx::GridFileWrapper::getMD5
::std::string getMD5(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GridFileWrapper.cpp:58
memoryx::GridFileWrapper::GridFileWrapper
GridFileWrapper(const mongo::GridFile &gridFile, const std::shared_ptr< std::mutex > &accessGridFSFilesMutex)
Definition: GridFileWrapper.cpp:34
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:917
memoryx::GridFilePtr
std::shared_ptr< mongo::GridFile > GridFilePtr
Definition: GridFileWrapper.h:37
memoryx::GridFileWrapper::getFilename
::std::string getFilename(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GridFileWrapper.cpp:52