~ubuntu-branches/ubuntu/wily/davix/wily

« back to all changes in this revision

Viewing changes to include/davix/davixcontext.hpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2014-07-08 09:59:36 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20140708095936-imto9hahxsnxwvw5
Tags: 0.3.1-1
Update to version 0.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This File is part of Davix, The IO library for HTTP based protocols
 
3
 * Copyright (C) 2013  Adrien Devresse <adrien.devresse@cern.ch>, CERN
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Lesser General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2.1 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Lesser General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Lesser General Public
 
16
 * License along with this library; if not, write to the Free Software
 
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 *
 
19
*/
 
20
 
 
21
 
1
22
#ifndef DAVIXCONTEXT_HPP
2
23
#define DAVIXCONTEXT_HPP
3
24
 
4
25
#include <string>
5
26
#include <status/davixstatusrequest.hpp>
6
 
 
7
 
#include <davixuri.hpp>
 
27
#include <hooks/davix_hooks.hpp>
 
28
#include <utils/davix_uri.hpp>
8
29
 
9
30
#ifndef __DAVIX_INSIDE__
10
31
#error "Only davix.h or davix.hpp should be included."
21
42
 
22
43
struct ContextInternal;
23
44
struct ContextExplorer;
 
45
class HookList;
24
46
class HttpRequest;
25
47
class DavPosix;
26
48
 
27
49
 
 
50
 
28
51
/// @brief Main handle for Davix
29
52
///
30
53
/// Each new davix context contains its own session-reuse pool and set of parameters
55
78
    /// clone this instance to a new context dynamically allocated,
56
79
    Context* clone();
57
80
 
58
 
 
59
 
 
60
 
    ///  enable or disablet the session caching
 
81
#ifndef DAVIX_STD_CXX03
 
82
 
 
83
    /// set a new hook (callback) to intercept event in davix
 
84
    /// see davix_hooks.hpp for more details about hooks
 
85
    /// WARNING: setting a new HOOK override exiting ones
 
86
    template<typename HookType>
 
87
    inline void setHook(const HookType & id){
 
88
        hookDefine<HookType>(getHookList(), id);
 
89
    }
 
90
 
 
91
    /// get the value register for one type of hook
 
92
    template<typename HookType>
 
93
    inline const HookType & getHook(){
 
94
        return hookGet<HookType>(getHookList());
 
95
    }
 
96
 
 
97
#endif
 
98
 
 
99
 
 
100
    /// @brief load a plugin or a profile identified by name
 
101
    /// @param name : name of the plugin or  profile to load
 
102
    ///
 
103
    /// Example: loadModule("grid") configure davix
 
104
    /// for a grid environment usage
 
105
    void loadModule(const std::string & name);
 
106
 
 
107
    ///  enable or disable the session caching
61
108
    void setSessionCaching(bool caching);
62
109
 
 
110
    /// get session caching status
63
111
    bool getSessionCaching() const;
64
112
 
65
 
 
66
 
    /// @deprecated
67
 
    HttpRequest* createRequest(const Uri & uri, DavixError** err);
68
 
    /// @deprecated
69
 
    HttpRequest* createRequest(const std::string & url, DavixError** err);
70
 
    /// @deprecated
71
 
    DavPosix* createDavPosix();
72
 
 
73
113
private:
74
114
    // internal context
75
115
    ContextInternal* _intern;
76
116
 
77
117
    friend class DavPosix;
78
118
    friend struct ContextExplorer;
 
119
    HookList & getHookList();
 
120
public:
 
121
 
 
122
    /// @deprecated
 
123
    HttpRequest* createRequest(const Uri & uri, DavixError** err);
 
124
    /// @deprecated
 
125
    HttpRequest* createRequest(const std::string & url, DavixError** err);
 
126
    /// @deprecated
 
127
    DavPosix* createDavPosix();
 
128
 
 
129
private:
 
130
 
79
131
};
80
132
 
81
133