summaryrefslogtreecommitdiff
path: root/cppe/src/IceE/DefaultsAndOverrides.cpp
blob: 75355f6eb225d1992981a33c41433f3b522fadf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// **********************************************************************
//
// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
//
// This copy of Ice-E is licensed to you under the terms described in the
// ICEE_LICENSE file included in this distribution.
//
// **********************************************************************

#include <IceE/DefaultsAndOverrides.h>
#include <IceE/Properties.h>
#include <IceE/Network.h>

using namespace std;
using namespace Ice;
using namespace IceInternal;

IceUtil::Shared* IceInternal::upCast(DefaultsAndOverrides* p) { return p; }

IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& properties) :
    overrideTimeout(false),
    overrideTimeoutValue(-1),
    overrideConnectTimeout(false),
    overrideConnectTimeoutValue(-1)
{
    const_cast<string&>(defaultHost) = properties->getProperty("Ice.Default.Host");

#ifdef ICEE_HAS_ROUTER
    const_cast<string&>(defaultRouter) = properties->getProperty("Ice.Default.Router");
#endif

    string value;
    
    value = properties->getProperty("Ice.Override.Timeout");
    if(!value.empty())
    {
	const_cast<bool&>(overrideTimeout) = true;
	const_cast<Int&>(overrideTimeoutValue) = properties->getPropertyAsInt("Ice.Override.Timeout");
    }

    value = properties->getProperty("Ice.Override.ConnectTimeout");
    if(!value.empty())
    {
	const_cast<bool&>(overrideConnectTimeout) = true;
	const_cast<Int&>(overrideConnectTimeoutValue) = properties->getPropertyAsInt("Ice.Override.ConnectTimeout");
    }

#ifdef ICEE_HAS_LOCATOR
    const_cast<string&>(defaultLocator) = properties->getProperty("Ice.Default.Locator");
#endif
}