<commit_before>/* *****************************************************************
 *
 * Copyright 2017 Microsoft
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ******************************************************************/

#ifndef CALLBACK_H_
#define CALLBACK_H_

typedef enum
{
    CallbackType_Discovery = 1,
    CallbackType_ResourceChange,
    CallbackType_GetPropertiesComplete,
    CallbackType_SetPropertiesComplete,
    CallbackType_CreateResourceComplete,
    CallbackType_DeleteResourceComplete,
    CallbackType_PasswordInputCallback,
    CallbackType_PasswordDisplayCallback,
    Callbacktype_RequestAccessCompletionCallback,
    CallbackType_InvalidType
} CallbackType;

class App;
class Device;
class OC::OCResource;
typedef std::shared_ptr<Device> DevicePtr;

// Structure contains information to make callbacks to app.
struct CallbackInfo
{
    public:
        CallbackInfo() { /* std::cout << "+ CallbackInfo " << this << std::endl; */ }
        ~CallbackInfo() { /* std::cout << "- CallbackInfo " << this << " mapKey: ";
                             std::cout << mapKey << std::endl; */ }
        typedef std::shared_ptr<CallbackInfo> Ptr;
        size_t mapKey;          // key to m_callbackInfoList map.  Initialized in AddCallbackInfo().
        App* app;               // the app that creates this callback.
        DevicePtr device;     // the device expected to respond to the callback.
        CallbackType type;
        union
        {
            IPCADiscoverDeviceCallback discoveryCallback;
            IPCAResourceChangeCallback resourceChangeCallback;
            IPCAGetPropertiesComplete getCallback;
            IPCASetPropertiesComplete setCallback;
            IPCACreateResourceComplete createResourceCallback;<commit_msg>IPCA: Declare class in namespace<commit_after>/* *****************************************************************
 *
 * Copyright 2017 Microsoft
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ******************************************************************/

#ifndef CALLBACK_H_
#define CALLBACK_H_

typedef enum
{
    CallbackType_Discovery = 1,
    CallbackType_ResourceChange,
    CallbackType_GetPropertiesComplete,
    CallbackType_SetPropertiesComplete,
    CallbackType_CreateResourceComplete,
    CallbackType_DeleteResourceComplete,
    CallbackType_PasswordInputCallback,
    CallbackType_PasswordDisplayCallback,
    Callbacktype_RequestAccessCompletionCallback,
    CallbackType_InvalidType
} CallbackType;

namespace OC {
    class OCResource;
}
class App;
class Device;
typedef std::shared_ptr<Device> DevicePtr;

// Structure contains information to make callbacks to app.
struct CallbackInfo
{
    public:
        CallbackInfo() { /* std::cout << "+ CallbackInfo " << this << std::endl; */ }
        ~CallbackInfo() { /* std::cout << "- CallbackInfo " << this << " mapKey: ";
                             std::cout << mapKey << std::endl; */ }
        typedef std::shared_ptr<CallbackInfo> Ptr;
        size_t mapKey;          // key to m_callbackInfoList map.  Initialized in AddCallbackInfo().
        App* app;               // the app that creates this callback.
        DevicePtr device;     // the device expected to respond to the callback.
        CallbackType type;
        union
        {
            IPCADiscoverDeviceCallback discoveryCallback;
            IPCAResourceChangeCallback resourceChangeCallback;
            IPCAGetPropertiesComplete getCallback;
            IPCASetPropertiesComplete setCallback;
            IPCACreateResourceComplete createResourceCallback;
{'fraction_non_alphanumeric': 0.12608506944444445, 'fraction_numerical': 0.00390625, 'mean_word_length': 3.4189837008628956, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6253085', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1087, 'n_words': 357}