in tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/domainmodels/codegeneration/cpp/CppViewHelper.java [451:494]
public static Set<String> computeSourceIncludes(String projectName, Shape shape) {
Set<String> headers = new LinkedHashSet<>();
Set<String> visited = new LinkedHashSet<>();
Queue<Shape> toVisit = shape.getMembers().values().stream().map(ShapeMember::getShape).collect(Collectors.toCollection(() -> new LinkedList<>()));
while(!toVisit.isEmpty()) {
Shape next = toVisit.remove();
visited.add(next.getName());
if(next.isMap()) {
if(!visited.contains(next.getMapKey().getShape().getName())) {
toVisit.add(next.getMapKey().getShape());
}
if(!visited.contains(next.getMapValue().getShape().getName())) {
toVisit.add(next.getMapValue().getShape());
}
}
if(next.isList())
{
if(!visited.contains(next.getListMember().getShape().getName()))
{
toVisit.add(next.getListMember().getShape());
}
}
if(!next.isPrimitive() && next.isMutuallyReferencedWith(shape)) {
headers.add(formatModelIncludeName(projectName, next));
}
}
for(Map.Entry<String, ShapeMember> entry : shape.getMembers().entrySet()) {
Shape innerShape = entry.getValue().getShape();
// if the shape is a blob, list of blobs or a map with a value blob. It's very unlikely that a blob would be
// the key in a map, but we check it anyways.
if (innerShape.isBlob() ||
(innerShape.isList() && innerShape.getListMember().getShape().isBlob()) ||
(innerShape.isMap() && innerShape.getMapValue().getShape().isBlob()) ||
(innerShape.isMap() && innerShape.getMapKey().getShape().isBlob())) {
headers.add("<aws/core/utils/HashingUtils.h>");
}
else if(entry.getValue().isUsedForHeader() || entry.getValue().isUsedForQueryString()) {
headers.add("<aws/core/utils/memory/stl/AWSStringStream.h>");
}
}
return headers;
}