Skip to content
GitLab
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
91daee59
Commit
91daee59
authored
Sep 06, 2016
by
Victor Kotlyar
Browse files
Moved castor::utils::SmartFILEPtr into
cta::SmartFILEPtr
parent
482f44eb
Changes
5
Hide whitespace changes
Inline
Side-by-side
common/CMakeLists.txt
View file @
91daee59
...
...
@@ -104,6 +104,7 @@ set (COMMON_LIB_SRC_FILES
remoteFS/RemotePath.cpp
remoteFS/RemotePathAndStatus.cpp
SmartFd.cpp
SmartFILEPtr.cpp
CRC.cpp
threading/ChildProcess.cpp
threading/Daemon.cpp
...
...
tapeserver/castor/utils
/SmartFILEPtr.cpp
→
common
/SmartFILEPtr.cpp
View file @
91daee59
/******************************************************************************
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
* This program 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.
*
* Copyright (C) 2003 CERN
* This program 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 2
* of the License, or (at your option) any later version.
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
*
*
@author Castor Dev team, castor-dev@cern.ch
****************************************************************************
*/
*
You should have received a copy of the GNU General Public License
*
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"c
astor/utils
/SmartFILEPtr.hpp"
#include
"c
ommon
/SmartFILEPtr.hpp"
#include
<errno.h>
#include
<unistd.h>
namespace
cta
{
//-----------------------------------------------------------------------------
// constructor
//-----------------------------------------------------------------------------
castor
::
utils
::
SmartFILEPtr
::
SmartFILEPtr
()
throw
()
:
SmartFILEPtr
::
SmartFILEPtr
()
throw
()
:
m_file
(
NULL
)
{
}
//-----------------------------------------------------------------------------
// constructor
//-----------------------------------------------------------------------------
castor
::
utils
::
SmartFILEPtr
::
SmartFILEPtr
(
FILE
*
const
file
)
throw
()
:
SmartFILEPtr
::
SmartFILEPtr
(
FILE
*
const
file
)
throw
()
:
m_file
(
file
)
{
}
//-----------------------------------------------------------------------------
// reset
//-----------------------------------------------------------------------------
void
castor
::
utils
::
SmartFILEPtr
::
reset
(
FILE
*
const
file
)
throw
()
{
void
SmartFILEPtr
::
reset
(
FILE
*
const
file
)
throw
()
{
// If the new pointer is not the one already owned
if
(
file
!=
m_file
)
{
...
...
@@ -61,7 +57,7 @@ void castor::utils::SmartFILEPtr::reset(FILE *const file) throw() {
//-----------------------------------------------------------------------------
// SmartFILEPtr assignment operator
//-----------------------------------------------------------------------------
castor
::
utils
::
SmartFILEPtr
&
castor
::
utils
::
SmartFILEPtr
::
operator
=
(
SmartFILEPtr
&
SmartFILEPtr
::
operator
=
(
SmartFILEPtr
&
obj
)
{
reset
(
obj
.
release
());
return
*
this
;
...
...
@@ -70,21 +66,21 @@ castor::utils::SmartFILEPtr &castor::utils::SmartFILEPtr::operator=(
//-----------------------------------------------------------------------------
// destructor
//-----------------------------------------------------------------------------
castor
::
utils
::
SmartFILEPtr
::~
SmartFILEPtr
()
throw
()
{
SmartFILEPtr
::~
SmartFILEPtr
()
throw
()
{
reset
();
}
//-----------------------------------------------------------------------------
// get
//-----------------------------------------------------------------------------
FILE
*
castor
::
utils
::
SmartFILEPtr
::
get
()
const
throw
()
{
FILE
*
SmartFILEPtr
::
get
()
const
throw
()
{
return
m_file
;
}
//-----------------------------------------------------------------------------
// release
//-----------------------------------------------------------------------------
FILE
*
castor
::
utils
::
SmartFILEPtr
::
release
()
{
FILE
*
SmartFILEPtr
::
release
()
{
// If this smart pointer does not own a pointer
if
(
NULL
==
m_file
)
{
cta
::
exception
::
NotAnOwner
ex
;
...
...
@@ -99,3 +95,5 @@ FILE *castor::utils::SmartFILEPtr::release() {
return
tmp
;
}
}
// namespace cta
tapeserver/castor/utils
/SmartFILEPtr.hpp
→
common
/SmartFILEPtr.hpp
View file @
91daee59
/******************************************************************************
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
* This program 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.
*
* Copyright (C) 2003 CERN
* This program 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 2
* of the License, or (at your option) any later version.
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
*
@author Castor Dev team, castor-dev@cern.ch
****************************************************************************
*/
*
You should have received a copy of the GNU General Public License
*
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
...
...
@@ -28,8 +23,7 @@
#include
<stdio.h>
namespace
castor
{
namespace
utils
{
namespace
cta
{
/**
* A smart pointer that owns a FILE pointer. When the smart pointer goes out
...
...
@@ -113,6 +107,5 @@ private:
};
// class SmartFILEPtr
}
// namespace utils
}
// namespace castor
}
// namespace cta
tapeserver/castor/tape/tapeserver/daemon/TpconfigLines.cpp
View file @
91daee59
...
...
@@ -23,7 +23,7 @@
*****************************************************************************/
#include
"castor/tape/tapeserver/daemon/TpconfigLines.hpp"
#include
"c
astor/utils
/SmartFILEPtr.hpp"
#include
"c
ommon
/SmartFILEPtr.hpp"
#include
"castor/utils/utils.hpp"
#include
"h/Castor_limits.h"
...
...
@@ -37,7 +37,7 @@ castor::tape::tapeserver::daemon::TpconfigLines castor::tape::tapeserver::
TpconfigLines
lines
;
// Open the TPCONFIG file for reading
ca
stor
::
utils
::
SmartFILEPtr
file
(
fopen
(
filename
.
c_str
(),
"r"
));
c
t
a
::
SmartFILEPtr
file
(
fopen
(
filename
.
c_str
(),
"r"
));
{
const
int
savedErrno
=
errno
;
...
...
tapeserver/castor/utils/CMakeLists.txt
View file @
91daee59
...
...
@@ -23,7 +23,6 @@ include_directories(/usr/include/shift)
include_directories
(
${
PROJECT_SOURCE_DIR
}
/tapeserver
)
set
(
UTILS_LIB_SRC_FILES
SmartFILEPtr.cpp
utils.cpp
../common/CastorConfiguration.cpp
../System.cpp
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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