Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "sal/config.h"
30 : :
31 : : #include <cstring>
32 : :
33 : : #include "boost/noncopyable.hpp"
34 : : #include "rtl/instance.hxx"
35 : : #include "rtl/process.h"
36 : : #include "rtl/uuid.h"
37 : : #include "sal/types.h"
38 : :
39 : : namespace {
40 : :
41 : 271 : class Id: private boost::noncopyable {
42 : : public:
43 [ + - ]: 271 : Id() { rtl_createUuid(uuid_, 0, false); }
44 : :
45 : 2185 : void copy(sal_uInt8 * target) const
46 : 2185 : { std::memcpy(target, uuid_, UUID_SIZE); }
47 : :
48 : : private:
49 : : enum { UUID_SIZE = 16 };
50 : :
51 : : sal_uInt8 uuid_[UUID_SIZE];
52 : : };
53 : :
54 : : struct theId: public rtl::Static< Id, theId > {};
55 : :
56 : : }
57 : :
58 : 2185 : void rtl_getGlobalProcessId(sal_uInt8 * pTargetUUID) {
59 : 2185 : theId::get().copy(pTargetUUID);
60 : 2185 : }
61 : :
62 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|