Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
e92123ba
Commit
e92123ba
authored
May 05, 2014
by
David COME
Browse files
Added a bunch of comments into AutoReleaseBlock and tapeserver/exception/Exception.hpp
parent
ca609e29
Changes
2
Hide whitespace changes
Inline
Side-by-side
castor/tape/tapeserver/daemon/AutoReleaseBlock.hpp
View file @
e92123ba
...
...
@@ -25,21 +25,42 @@
#pragma once
#include <memory>
#include "castor/tape/tapeserver/daemon/MemBlock.hpp"
namespace
castor
{
namespace
tape
{
namespace
tapeserver
{
namespace
daemon
{
/*Use RAII to make sure the memory block is released
/*
* Use RAII to make sure the memory block is released
*(ie pushed back to the memory manager) in any case (exception or not)
* Example of use
* {
* MemBlock* block = getItFromSomewhere()
* {Recall/Migration}MemoryManager mm;
* AutoReleaseBlock releaser(block,mm);
* }
*/
template
<
class
MemManagerT
>
class
AutoReleaseBlock
{
MemBlock
*
m_block
;
/**
* The block to release
*/
MemBlock
*
const
m_block
;
/**
* To whom it should be given back
*/
MemManagerT
&
memManager
;
public:
AutoReleaseBlock
(
MemBlock
*
mb
,
MemManagerT
&
mm
)
:
/**
*
* @param mb he block to release
* @param mm To whom it should be given back
*/
AutoReleaseBlock
(
MemBlock
*
const
mb
,
MemManagerT
&
mm
)
:
m_block
(
mb
),
memManager
(
mm
){}
//let the magic begin
~
AutoReleaseBlock
(){
memManager
.
releaseBlock
(
m_block
);
}
...
...
castor/tape/tapeserver/exception/Exception.hpp
View file @
e92123ba
...
...
@@ -53,8 +53,9 @@ namespace tape {
EndOfFile
(
const
std
::
string
&
w
)
:
castor
::
exception
::
Exception
(
w
)
{}
virtual
~
EndOfFile
()
throw
()
{}
};
/**
* Used
* Used
to signal an error has happened during the migration process
*/
class
ErrorFlag
:
public
castor
::
exception
::
Exception
{
public:
...
...
@@ -62,7 +63,9 @@ namespace tape {
virtual
~
ErrorFlag
()
throw
()
{}
};
/**
* A generic exception thrown when there is something wrong with the memory
*/
class
MemException
:
public
castor
::
tape
::
Exception
{
public:
MemException
(
const
std
::
string
&
what
)
:
Exception
(
what
)
{}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment