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
30namespace mongo
31{
32 class GridFile;
33}
34
35namespace 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
::Ice::Long getFileSize(const ::Ice::Current &=Ice::emptyCurrent) override
::std::string getMD5(const ::Ice::Current &=Ice::emptyCurrent) override
Ice::Identity getIceId() const
::Ice::Long getUploadDate(const ::Ice::Current &=Ice::emptyCurrent) override
::std::string getId(const ::Ice::Current &=Ice::emptyCurrent) override
::std::string getFilename(const ::Ice::Current &=Ice::emptyCurrent) override
::Ice::Int getNextChunk(::memoryx::Blob &buffer, const ::Ice::Current &=Ice::emptyCurrent) override
GridFileWrapper(const mongo::GridFile &gridFile, const std::shared_ptr< std::mutex > &accessGridFSFilesMutex)
VirtualRobot headers.
IceInternal::Handle< GridFileWrapper > GridFileWrapperPtr
std::shared_ptr< mongo::GridFile > GridFilePtr