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 <MemoryX/interface/core/GridFileInterface.h>
26 
27 #include <memory>
28 #include <mutex>
29 
30 namespace mongo
31 {
32  class GridFile;
33 }
34 
35 namespace memoryx
36 {
37  using GridFilePtr = std::shared_ptr<mongo::GridFile>;
39  public memoryx::GridFileInterface
40  {
41  public:
42  GridFileWrapper(const mongo::GridFile& gridFile, const std::shared_ptr<std::mutex>& accessGridFSFilesMutex);
43  ~GridFileWrapper() override;
44 
45  // implement methods of GridFileInterface
46  ::std::string getId(const ::Ice::Current& = Ice::emptyCurrent) override;
47 
48  ::std::string getFilename(const ::Ice::Current& = Ice::emptyCurrent) override;
49 
50  ::std::string getMD5(const ::Ice::Current& = Ice::emptyCurrent) override;
51 
52  ::Ice::Long getFileSize(const ::Ice::Current& = Ice::emptyCurrent) override;
53 
54  ::Ice::Long getUploadDate(const ::Ice::Current& = Ice::emptyCurrent) override;
55 
56  ::Ice::Int getNextChunk(::memoryx::Blob& buffer, const ::Ice::Current& = Ice::emptyCurrent) override;
57 
58  // helper methods
59  Ice::Identity getIceId() const;
60 
61  private:
62  GridFilePtr gridFile;
63  int nextChunkNo;
64 
65  Ice::Identity iceId;
66  std::shared_ptr<std::mutex> accessGridFSFilesMutex;
67  };
68 
70 
71 }
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::GridFileWrapper::getIceId
Ice::Identity getIceId() const
Definition: GridFileWrapper.cpp:109
memoryx::GridFileWrapper::getFileSize
::Ice::Long getFileSize(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GridFileWrapper.cpp:58
mongo
Definition: CommonStorage.h:34
IceInternal::Handle
Definition: forward_declarations.h:8
memoryx::GridFileWrapper::getUploadDate
::Ice::Long getUploadDate(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GridFileWrapper.cpp:63
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:523
memoryx::GridFileWrapper::getId
::std::string getId(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GridFileWrapper.cpp:43
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:917
memoryx::GridFileWrapper::getNextChunk
::Ice::Int getNextChunk(::memoryx::Blob &buffer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GridFileWrapper.cpp:68
memoryx::GridFileWrapper::~GridFileWrapper
~GridFileWrapper() override
memoryx::GridFileWrapper
Definition: GridFileWrapper.h:38
memoryx::GridFileWrapper::getMD5
::std::string getMD5(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: GridFileWrapper.cpp:53
memoryx::GridFileWrapper::GridFileWrapper
GridFileWrapper(const mongo::GridFile &gridFile, const std::shared_ptr< std::mutex > &accessGridFSFilesMutex)
Definition: GridFileWrapper.cpp:32
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:916
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:48