blob: 5d791bb321c36e2e71526fd24c90ca7152ed2878 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
#include "StopContainersRequest.h"
namespace libyarn {
StopContainersRequest::StopContainersRequest() {
requestProto = StopContainersRequestProto::default_instance();
}
StopContainersRequest::StopContainersRequest(const StopContainersRequestProto &proto) {
requestProto = proto;
}
StopContainersRequest::~StopContainersRequest() {
}
StopContainersRequestProto& StopContainersRequest::getProto(){
return requestProto;
}
void StopContainersRequest::setContainerIds(
std::list<ContainerId> &containerIds) {
for (list<ContainerId>::iterator it = containerIds.begin(); it != containerIds.end(); it++) {
ContainerIdProto *proto = requestProto.add_container_id();
proto->CopyFrom((*it).getProto());
}
}
list<ContainerId> StopContainersRequest::getContainerIds() {
list<ContainerId> cids;
int size = requestProto.container_id_size();
for (int i = 0; i < size; i++) {
ContainerIdProto proto = requestProto.container_id(i);
ContainerId cid(proto);
cids.push_back(cid);
}
return cids;
}
} /* namespace libyarn */