<commit_before>/*
 * #%L
 * %%
 * Copyright (C) 2011 - 2017 BMW Car IT GmbH
 * %%
 * 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.
 * #L%
 */
#include "joynr/JoynrMessage.h"

#include <chrono>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include <utility>

#include "joynr/Util.h"

namespace joynr
{
INIT_LOGGER(JoynrMessage);

const std::string& JoynrMessage::HEADER_CONTENT_TYPE()
{
    static const std::string headerContentType("contentType");
    return headerContentType;
}

const std::string& JoynrMessage::HEADER_MESSAGE_ID()
{
    static const std::string headerMessageId("msgId");
    return headerMessageId;
}

const std::string& JoynrMessage::HEADER_CREATOR_USER_ID()
{
    static const std::string headerCreatorUserId("creator");
    return headerCreatorUserId;
}

const std::string& JoynrMessage::HEADER_TO()
{
    static const std::string headerTo("to");
    return headerTo;
}
const std::string& JoynrMessage::HEADER_FROM()
{
    static const std::string headerFrom("from");
    return headerFrom;
}
const std::string& JoynrMessage::HEADER_EXPIRY_DATE()
{
    static const std::string headerExpiryDate("expiryDate");
    return headerExpiryDate;
}
const std::string& JoynrMessage::HEADER_REPLY_ADDRESS()
{
    static const std::string headerReplyAddress("replyChannelId");
    return headerReplyAddress;
}
const std::string& JoynrMessage::HEADER_EFFORT()
{
    static const std::string headerEffort("effort");
    return headerEffort;
}
const std::string& JoynrMessage::CUSTOM_HEADER_PREFIX()
{
    static const std::string customHeaderPrefix("custom-");
    return customHeaderPrefix;
}

const std::string JoynrMessage::CUSTOM_HEADER_REQUEST_REPLY_ID = "z4";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_ONE_WAY = "oneWay";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_REPLY = "reply";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_REQUEST = "request";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_PUBLICATION = "subscriptionPublication";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_MULTICAST = "multicast";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_REPLY = "subscriptionReply";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_REQUEST = "subscriptionRequest";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_MULTICAST_SUBSCRIPTION_REQUEST =
        "multicastSubscriptionRequest";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_BROADCAST_SUBSCRIPTION_REQUEST =
        "broadcastSubscriptionRequest";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_STOP = "subscriptionStop";

const std::string JoynrMessage::VALUE_CONTENT_TYPE_TEXT_PLAIN = "text/plain";
const std::string JoynrMessage::VALUE_CONTENT_TYPE_APPLICATION_JSON = "application/json";

JoynrMessage::JoynrMessage()
        : type(""), header(), payload(), receivedFromGlobal(false), localMessage(false)
{
    generateAndSetMsgIdHeaderIfAbsent();
}

JoynrMessage::JoynrMessage(const JoynrMessage& message)
        : type(message.type),
          header(message.header),
          payload(message.payload),
          receivedFromGlobal(false),
          localMessage(false)
{
    generateAndSetMsgIdHeaderIfAbsent();
}

JoynrMessage& JoynrMessage::operator=(const JoynrMessage& message)
{
    type = message.type;
    header = message.header;
    payload = message.payload;
    receivedFromGlobal = message.receivedFromGlobal;
    localMessage = message.localMessage;
    generateAndSetMsgIdHeaderIfAbsent();
    return *this;
}

JoynrMessage::JoynrMessage(JoynrMessage&& message)
        : type(std::move(message.type)),
          header(std::move(message.header)),
          payload(std::move(message.payload)),
          receivedFromGlobal(std::move(message.receivedFromGlobal)),
          localMessage(std::move(message.localMessage))
{
    generateAndSetMsgIdHeaderIfAbsent();
}

JoynrMessage& JoynrMessage::operator=(JoynrMessage&& message)
{
    type = std::move(message.type);
    header = std::move(message.header);
    payload = std::move(message.payload);
    receivedFromGlobal = std::move(message.receivedFromGlobal);
    localMessage = std::move(message.localMessage);
    generateAndSetMsgIdHeaderIfAbsent();
    return *this;
}<commit_msg>[C++] do not move trivially-copyable bool members<commit_after>/*
 * #%L
 * %%
 * Copyright (C) 2011 - 2017 BMW Car IT GmbH
 * %%
 * 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.
 * #L%
 */
#include "joynr/JoynrMessage.h"

#include <chrono>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include <utility>

#include "joynr/Util.h"

namespace joynr
{
INIT_LOGGER(JoynrMessage);

const std::string& JoynrMessage::HEADER_CONTENT_TYPE()
{
    static const std::string headerContentType("contentType");
    return headerContentType;
}

const std::string& JoynrMessage::HEADER_MESSAGE_ID()
{
    static const std::string headerMessageId("msgId");
    return headerMessageId;
}

const std::string& JoynrMessage::HEADER_CREATOR_USER_ID()
{
    static const std::string headerCreatorUserId("creator");
    return headerCreatorUserId;
}

const std::string& JoynrMessage::HEADER_TO()
{
    static const std::string headerTo("to");
    return headerTo;
}
const std::string& JoynrMessage::HEADER_FROM()
{
    static const std::string headerFrom("from");
    return headerFrom;
}
const std::string& JoynrMessage::HEADER_EXPIRY_DATE()
{
    static const std::string headerExpiryDate("expiryDate");
    return headerExpiryDate;
}
const std::string& JoynrMessage::HEADER_REPLY_ADDRESS()
{
    static const std::string headerReplyAddress("replyChannelId");
    return headerReplyAddress;
}
const std::string& JoynrMessage::HEADER_EFFORT()
{
    static const std::string headerEffort("effort");
    return headerEffort;
}
const std::string& JoynrMessage::CUSTOM_HEADER_PREFIX()
{
    static const std::string customHeaderPrefix("custom-");
    return customHeaderPrefix;
}

const std::string JoynrMessage::CUSTOM_HEADER_REQUEST_REPLY_ID = "z4";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_ONE_WAY = "oneWay";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_REPLY = "reply";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_REQUEST = "request";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_PUBLICATION = "subscriptionPublication";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_MULTICAST = "multicast";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_REPLY = "subscriptionReply";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_REQUEST = "subscriptionRequest";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_MULTICAST_SUBSCRIPTION_REQUEST =
        "multicastSubscriptionRequest";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_BROADCAST_SUBSCRIPTION_REQUEST =
        "broadcastSubscriptionRequest";
const std::string JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_STOP = "subscriptionStop";

const std::string JoynrMessage::VALUE_CONTENT_TYPE_TEXT_PLAIN = "text/plain";
const std::string JoynrMessage::VALUE_CONTENT_TYPE_APPLICATION_JSON = "application/json";

JoynrMessage::JoynrMessage()
        : type(""), header(), payload(), receivedFromGlobal(false), localMessage(false)
{
    generateAndSetMsgIdHeaderIfAbsent();
}

JoynrMessage::JoynrMessage(const JoynrMessage& message)
        : type(message.type),
          header(message.header),
          payload(message.payload),
          receivedFromGlobal(false),
          localMessage(false)
{
    generateAndSetMsgIdHeaderIfAbsent();
}

JoynrMessage& JoynrMessage::operator=(const JoynrMessage& message)
{
    type = message.type;
    header = message.header;
    payload = message.payload;
    receivedFromGlobal = message.receivedFromGlobal;
    localMessage = message.localMessage;
    generateAndSetMsgIdHeaderIfAbsent();
    return *this;
}

JoynrMessage::JoynrMessage(JoynrMessage&& message)
        : type(std::move(message.type)),
          header(std::move(message.header)),
          payload(std::move(message.payload)),
          receivedFromGlobal(message.receivedFromGlobal),
          localMessage(message.localMessage)
{
    generateAndSetMsgIdHeaderIfAbsent();
}

JoynrMessage& JoynrMessage::operator=(JoynrMessage&& message)
{
    type = std::move(message.type);
    header = std::move(message.header);
    payload = std::move(message.payload);
    receivedFromGlobal = message.receivedFromGlobal;
    localMessage = message.localMessage;
    generateAndSetMsgIdHeaderIfAbsent();
    return *this;
}
{'fraction_non_alphanumeric': 0.11109943241538785, 'fraction_numerical': 0.0027328147992432207, 'mean_word_length': 5.663165266106443, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '4928603', 'n_tokens_mistral': 2846, 'n_tokens_neox': 2784, 'n_words': 602}